Skip to main content
๐Ÿ“˜ Complete PDF

Snowflake Certification Practice Test 04

Practice Test 04

Question 1 of 10
๐Ÿ“‹ Multiple Choice
Question 61
A newly joined Data Engineer at a global retail company is assigned to investigate poor query performance on a 15 TB sales transactions table. Queries consistently filter on `transaction_date` and `store_region`, but the Query Profile shows that almost every query scans 100% of all micro-partitions. Which Snowflake performance optimization technique should be evaluated to co-locate related records and maximize micro-partition pruning?
A. Traditional B-Tree Non-Clustered Indexes
โœ“
B. Clustering Strategy (Defining a Clustering Key)
C. Increasing Auto-Suspend Timeout to 60 minutes
D. Converting the Table to a Temporary View
Answer
โœ… B. Clustering Strategy (Defining a Clustering Key)
Explanation

1. Concept Overview Snowflake organizes table data into immutable **micro-partitions** (50 MB to 500 MB uncompressed). By default, Snowflake orders micro-partitions by the arrival order of data (natural clustering). For multi-terabyte tables where queries filter heavily on specific columns, defining an explicit **Clustering Key** directs Snowflake to co-locate related rows within the same micro-partitions, dramatically boosting **micro-partition pruning**.

2. Why the Correct Option is Right A **Clustering Strategy (Defining a Clustering Key)** physically organizes micro-partitions based on designated columns (e.g., `CLUSTER BY (transaction_date, store_region)`). Once clustered, queries filtering on those columns scan only a tiny fraction of micro-partitions, reducing I/O, compute time, and credit consumption.

3. Why Other Options Are Incorrect - **Traditional B-Tree Non-Clustered Indexes:** Snowflake does not support or utilize traditional B-tree indexes; indexing is handled natively via micro-partitions, metadata pruning, and Search Optimization. - **Increasing Auto-Suspend Timeout to 60 minutes:** Keeps idle warehouses running longer, which increases compute costs without improving query scan efficiency or partition pruning. - **Converting the Table to a Temporary View:** Views are logical query wrappers that do not alter physical storage layout; querying the view will scan the exact same unpruned micro-partitions.

4. Production Scenario / Code Example

-- Checking current clustering depth and overlap
SELECT SYSTEM$CLUSTERING_INFORMATION('sales_transactions', '(transaction_date, store_region)');

-- Defining a clustering key on the table
ALTER TABLE sales_transactions CLUSTER BY (transaction_date, store_region);

-- Snowflake manages re-clustering automatically in the background:
-- Background Automatic Clustering consumes serverless credits to maintain clustering depth as new data arrives.

5. Real-World Architecture Context Clustering is not necessary for most tables because natural clustering (data loaded chronologically) is sufficient. Explicit clustering keys should be reserved for large multi-terabyte tables with high query concurrency, specific repetitive filter patterns, and poor natural pruning.

6. Common Pitfalls & Anti-Patterns - **Clustering small tables (< 1 TB):** Defining clustering keys on small tables incurs background Automatic Clustering maintenance credits with zero noticeable query speedup. - **Choosing high-cardinality keys like UUIDs:** Clustering on timestamps with millisecond precision or unique IDs degrades clustering efficiency. Use low-to-medium cardinality columns (e.g., date, region, department).

7. Performance & Cost Considerations Automatic Clustering runs continuously in the background using serverless compute. Monitor `snowflake.account_usage.automatic_clustering_history` to verify that query performance gains justify background re-clustering credit spend.

8. Exam / Interview Tip Remember: Snowflake does NOT use indexes! Table clustering uses **Clustering Keys** to co-locate data within micro-partitions.

9. Key Takeaways - Clustering keys co-locate related data into the same micro-partitions. - Dramatically accelerates query pruning on multi-terabyte tables. - Maintained automatically via Snowflake's serverless Automatic Clustering service.

10. Related Tutorials & Resources - [Clustering Keys in Snowflake Explained](/tutorials/snowflake/snowflake-clustering-keys-explained) - [Performance Tuning Techniques for Daily Work](/tutorials/snowflake/snowflake-performance-tuning)`

Answered: 0 / 10
Question Navigator (Test 04)0% Answered