Domain: Snowflake Features & Architecture
· 608 words · 10 min read

Micro-Partitions and Clustering

Overview

Micro-partitions are the fundamental building blocks of Snowflake's storage architecture. Unlike traditional databases where database administrators manually define partitions and indexes, Snowflake handles this automatically. For the COF-C03 exam, you must understand how micro-partitions work, how data is pruned during queries, and when to intervene with manual clustering.

Key Concepts

Micro-Partitions

All data in Snowflake tables is automatically divided into micro-partitions.

Query Pruning (The Cloud Services Layer Magic)

Because Snowflake does not use traditional indexes, it relies on metadata to find data fast.

Natural Clustering

As data is loaded into Snowflake (e.g., by date), it is naturally ordered in the micro-partitions. If you typically query your data by the same order it is loaded (like querying logs by timestamp), Snowflake's natural clustering provides excellent performance without any manual intervention.

Clustering Keys and Automatic Clustering

Over time, as data is updated, deleted, or inserted out of order, the natural clustering can degrade (micro-partitions begin to overlap in their MIN/MAX ranges), leading to less effective pruning.

How It Works: Clustering Depth

Clustering Depth is a metric that measures how overlapping the micro-partitions are.

SQL Examples


-- Check the clustering depth of a table based on a specific column
SELECT SYSTEM$CLUSTERING_DEPTH('sales_data', '(sales_date)');

-- Define a clustering key on an existing table
ALTER TABLE sales_data CLUSTER BY (sales_date, region);

-- Suspend automatic clustering (stops background reorganization and billing)
ALTER TABLE sales_data SUSPEND RECLUSTER;

Exam Tips

⚠️ Crucial for COF-C03:

Key Takeaways