To identify long-running queries in the last hour, which query is correct?

Master Snowflake Data Engineer Exam. Study with flashcards and multiple choice questions, each question includes hints and explanations. Prepare for your success!

Multiple Choice

To identify long-running queries in the last hour, which query is correct?

Explanation:
To identify long-running queries in the last hour, you fetch query history for a one-hour window by using Snowflake’s table function for information_schema.query_history with a precise start and end timestamp. The correct approach passes a start time of dateadd('hour', -1, current_timestamp()) and an end time of current_timestamp() into the table function, then reads the results. This pattern is exactly what option A does: it calls table(information_schema.query_history(...)) with the last-hour window and returns the rows, ordering by total_elapsed_time so you can spot longer executions (you could add DESC to surface the longest first if you want). The other options don’t correctly specify the time window or the function invocation: they either attempt to filter without using the table function, reference a specific database/schema path in a way that isn’t valid for the query_history function, or rely on a timestamp arithmetic form that isn’t appropriate for this API.

To identify long-running queries in the last hour, you fetch query history for a one-hour window by using Snowflake’s table function for information_schema.query_history with a precise start and end timestamp. The correct approach passes a start time of dateadd('hour', -1, current_timestamp()) and an end time of current_timestamp() into the table function, then reads the results. This pattern is exactly what option A does: it calls table(information_schema.query_history(...)) with the last-hour window and returns the rows, ordering by total_elapsed_time so you can spot longer executions (you could add DESC to surface the longest first if you want). The other options don’t correctly specify the time window or the function invocation: they either attempt to filter without using the table function, reference a specific database/schema path in a way that isn’t valid for the query_history function, or rely on a timestamp arithmetic form that isn’t appropriate for this API.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy