SnowPro Associate: Platform Question 51
Single answerQuery historyA Snowflake administrator needs to investigate why a dashboard query ran slowly this morning. The query was executed less than an hour ago by an analyst using a worksheet in Snowsight. The administrator wants to quickly review the SQL text, execution status, start time, and elapsed time for that specific statement without building a custom monitoring table. Which approach should the administrator use?
- A
Query the ACCOUNT_USAGE.QUERY_HISTORY view for the statement because it provides real-time query activity with no latency
- B
Use the QUERY_HISTORY table function in the INFORMATION_SCHEMA schema to retrieve recent query execution details
- C
Run SHOW QUERIES in the analyst's schema because SHOW commands return the full execution profile for recent statements
- D
Query the WAREHOUSE_LOAD_HISTORY view to find the exact SQL text and execution status for the statement
Show answer and explanation
Correct answer: B
Explanation
For recent troubleshooting, Snowflake provides QUERY_HISTORY table functions in INFORMATION_SCHEMA, which are appropriate when an administrator needs to inspect recent statements and associated metadata such as query text, status, timing, and user context. In contrast, SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY is excellent for broader historical reporting and account-level analysis, but it can have ingestion latency, so it is less suitable for immediate investigation of a query that just ran. WAREHOUSE_LOAD_HISTORY is useful for understanding warehouse utilization, queued load, and concurrency trends, but not for retrieving the exact SQL text of a specific query. This aligns with Snowflake documentation distinguishing Information Schema table functions for recent activity from Account Usage views for historical monitoring.
- A. Incorrect.
Incorrect. SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY is useful for historical analysis across the account, but ACCOUNT_USAGE views typically have latency and are not intended for the most immediate, near-real-time troubleshooting of a query that ran within the last hour. A common misconception is that ACCOUNT_USAGE is instantly updated.
- B. Correct.
Correct. The INFORMATION_SCHEMA QUERY_HISTORY table function is designed for retrieving recent query execution metadata, including SQL text, execution status, start time, and elapsed time. It is commonly used for operational troubleshooting when an administrator needs recent query details without creating custom monitoring objects.
- C. Incorrect.
Incorrect. SHOW commands can list some object metadata, but SHOW QUERIES is not the standard method for retrieving detailed recent query history in Snowflake for this use case. Candidates may confuse SHOW-style commands with system-provided query history functions, but detailed query metadata is typically accessed through QUERY_HISTORY functions or account usage views.
- D. Incorrect.
Incorrect. WAREHOUSE_LOAD_HISTORY helps analyze warehouse load and concurrency patterns, not the SQL text and detailed execution status of an individual statement. Someone might choose this option because warehouse performance can affect query speed, but it does not provide the specific statement-level details requested.