
Answer-first summary for fast verification
Answer: Query against the metadata cache
Snowflake optimizes COUNT(1) operations by using metadata statistics stored in the metadata cache rather than scanning the actual table data. For a table with 100 million records, scanning the result set cache (A) would only apply if the exact same query was recently executed. Querying against a virtual warehouse cache (B) is not a standard Snowflake concept. Querying against the most-recently created micro-partition (C) would be inefficient and incorrect for a full table count. The metadata cache (D) contains statistical information about tables, including row counts, allowing Snowflake to quickly return the result without data scanning, which aligns with the community consensus and Snowflake's documented optimization for aggregate functions on entire tables.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
A table named FCT_SALES contains 100 million records.
The following query is executed:
SELECT COUNT(1) FROM FCT_SALES;
SELECT COUNT(1) FROM FCT_SALES;
How does Snowflake process this query?
A
Query against the result set cache
B
Query against a virtual warehouse cache
C
Query against the most-recently created micro-partition
D
Query against the metadata cache
No comments yet.