Question 1 · Snowflake Architecture
A Snowflake architect is designing the clustering strategy for a TRANSACTIONS fact table containing 4 billion rows. The table is primarily queried by analysts who filter on TRANSACTION_DATE (a DATE column with ~1,000 distinct values) and occasionally filter on MERCHANT_CATEGORY (a VARCHAR column with 25 distinct values). The architect wants to maximize micro-partition pruning for the most common query pattern. Which clustering key definition should the architect choose?
Show answer & explanation
Correct answer: D
- D. CLUSTER BY (TRANSACTION_DATE)
Option D is correct. For maximum micro-partition pruning, the leading column of the clustering key should be the highest-cardinality column that appears most frequently in WHERE clause filters — TRANSACTION_DATE with ~1,000 distinct values fits perfectly as the sole key for the dominant query pattern. Option C is wrong: placing MERCHANT_CATEGORY (only 25 distinct values, low cardinality) first means Snowflake sorts data by that column first, resulting in poor pruning for date-range queries. Option A adds MERCHANT_CATEGORY as a secondary key, which is not harmful but adds unnecessary reclustering cost because the column has very low cardinality and queries rarely filter on it exclusively. Option B is incorrect: clustering on a high-cardinality synthetic primary key like TRANSACTION_ID creates extremely fine-grained micro-partitions with almost no rows per unique value, providing no pruning benefit for range or categorical filters and wasting significant credits.