COF-C03 Question 268
Single answerQuery attributionA Snowflake administrator needs to identify which business unit is generating the highest compute cost from SQL activity on a shared warehouse. Users from multiple departments run queries through different BI tools and service accounts, making warehouse-level metering alone insufficient. The company wants a reliable way to attribute query costs to the correct business unit for chargeback reporting. Which approach should the administrator use?
- A
Require each session to set a QUERY_TAG value that includes the business unit, then analyze query history grouped by QUERY_TAG
- B
Create one database per business unit and use DATABASE_STORAGE_USAGE_HISTORY to determine which unit generated the most query compute cost
- C
Use WAREHOUSE_METERING_HISTORY alone, because Snowflake automatically breaks warehouse credits down by department in shared-warehouse environments
- D
Rely on the ROLE used to run each query, because Snowflake guarantees that each role maps to exactly one business unit for cost attribution
Show answer and explanation
Correct answer: A
Explanation
The best answer is to use QUERY_TAG for query attribution. In Snowflake, query attribution is commonly implemented by setting a session-level or statement-level QUERY_TAG that captures business context such as department, project, dashboard, ETL job, or cost center. Administrators can then analyze ACCOUNT_USAGE.QUERY_HISTORY or INFORMATION_SCHEMA query history functions and group by QUERY_TAG to identify which workload generated activity on a shared warehouse. This approach is especially valuable when multiple BI tools, users, or service accounts share the same compute resources. By contrast, WAREHOUSE_METERING_HISTORY provides warehouse-level credit consumption but not automatic departmental attribution, and storage views such as DATABASE_STORAGE_USAGE_HISTORY are unrelated to compute cost from queries. Snowflake documentation and best practices around query tagging emphasize using QUERY_TAG to improve observability, workload analysis, and chargeback/showback reporting.
- A. Correct.
Correct. QUERY_TAG is designed to label queries with business context such as department, application, cost center, or pipeline name. By requiring applications, BI tools, or users to set QUERY_TAG consistently, the administrator can query ACCOUNT_USAGE.QUERY_HISTORY or related views and aggregate activity by tag for attribution and chargeback analysis. This is a common best practice when multiple users and service accounts share the same warehouse.
- B. Incorrect.
Incorrect. DATABASE_STORAGE_USAGE_HISTORY is for storage consumption, not query compute attribution. Even if each business unit has its own database, storage metrics do not show which queries consumed warehouse compute credits. The scenario is specifically about SQL activity and shared warehouse compute cost, so storage history does not solve the problem.
- C. Incorrect.
Incorrect. WAREHOUSE_METERING_HISTORY shows credits consumed at the warehouse level, which is useful for total warehouse cost tracking, but it does not automatically attribute those credits to departments or business units. In a shared warehouse model, additional metadata such as QUERY_TAG is needed to allocate usage more precisely.
- D. Incorrect.
Incorrect. Roles can sometimes help with analysis, but Snowflake does not guarantee that a role maps one-to-one with a business unit. Users and service accounts may use multiple roles, and shared functional roles are common. Depending only on ROLE_NAME can lead to inaccurate attribution unless the organization has very strict governance, which is not stated here.