COF-C03 Question 267
Single answerSNOWFLAKE.ACCOUNT_USAGE views (Snowflake database views)A Snowflake administrator needs to create a weekly governance report that shows which users executed the most expensive queries during the last 7 days, including the warehouse used and the execution time. The report must use Snowflake-provided account-level metadata views rather than information schema table functions. Which SNOWFLAKE.ACCOUNT_USAGE view should be the primary source for this report?
- A
SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY
- B
SNOWFLAKE.ACCOUNT_USAGE.ACCESS_HISTORY
- C
SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY
- D
SNOWFLAKE.ACCOUNT_USAGE.LOGIN_HISTORY
Show answer and explanation
Correct answer: A
Explanation
For reporting on expensive queries by user, the best SNOWFLAKE.ACCOUNT_USAGE starting point is QUERY_HISTORY because it contains per-query execution metadata, including the user and warehouse involved, as well as timing information. In practice, administrators often use QUERY_HISTORY for operational monitoring and then enrich it with other ACCOUNT_USAGE views if they need user, warehouse, or billing context. By contrast, ACCESS_HISTORY is focused on object access auditing, WAREHOUSE_METERING_HISTORY is focused on aggregate warehouse credit usage rather than individual queries, and LOGIN_HISTORY is limited to authentication events. Snowflake documentation for ACCOUNT_USAGE identifies QUERY_HISTORY as the core account-level view for historical query metadata, with the important operational consideration that ACCOUNT_USAGE views can have latency before data appears.
- A. Correct.
Correct. QUERY_HISTORY is the primary ACCOUNT_USAGE view for analyzing executed SQL statements. It includes details such as the user, warehouse, query text, execution status, start/end times, and elapsed time metrics. For a report identifying users running costly queries over the last 7 days, this view is the most appropriate starting point. It can also be joined to warehouse or user metadata if needed.
- B. Incorrect.
Incorrect. ACCESS_HISTORY is used to analyze data access lineage and object-level access, such as which tables, columns, or views were touched by queries. Although it is useful for auditing data access patterns, it is not the best primary source for query runtime and warehouse execution reporting.
- C. Incorrect.
Incorrect. WAREHOUSE_METERING_HISTORY provides warehouse credit consumption and metering data at the warehouse level. It is helpful for understanding warehouse cost trends, but it does not provide per-query detail or identify which individual users executed specific expensive queries.
- D. Incorrect.
Incorrect. LOGIN_HISTORY tracks authentication events such as user logins and connection attempts. It does not contain query execution metrics, warehouse usage per query, or elapsed query time, so it cannot serve as the main source for this report.