Cert EspressoLearn. Practise. Find your flow.

A LITTLE FOCUS.
A BIG NEXT STEP.

Your pace. Your space.
Snowflake · SnowPro Core

Micro-Partitions, Pruning, and Clustering

SnowPro Core · Lesson 7 of 27 · 36:22

YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗

Learning with these videos? Subscribe for new courses and exam-style questions.

In this lesson

Prepare for the SnowPro Core Certification exam (COF-C03). In this lesson: micro-partitions and their metadata, pruning, clustering keys and clustering depth, and Automatic Clustering. Follows Foxglove Apparel, a fictional online clothing retailer. Includes three original practice questions.

Study notes

The text of this lesson, to read at your own pace. Information as of November 2026.

Fast for dates, slow for countries

Foxglove's orders table holds four billion rows, loaded every day in date order. A query for one day returns in a second, but a query for one shipping country scans almost the whole table. The difference comes from micro-partitions and clustering.

Micro-partitions

Snowflake divides every table into micro-partitions automatically, with nothing for you to define or maintain. Each one holds between fifty and five hundred megabytes of uncompressed data, and it is stored compressed. Rows go into micro-partitions in the order they are inserted or loaded. And inside each micro-partition, every column is stored on its own, which is columnar storage.

Metadata and pruning

For each micro-partition, Snowflake keeps metadata, such as the range of values of each column, and the number of distinct values. When a query has a filter, Snowflake uses that metadata to skip every micro-partition that cannot hold a matching row, which is called pruning. Then, it reads only the columns that the query uses. But not every filter can prune: a filter that compares a column with a subquery is not used for pruning, even if the subquery returns a constant.

Clustering and clustering depth

Data is naturally clustered by the order in which it arrives, often by date. When the values of a column are spread across many micro-partitions, their ranges overlap, and pruning works poorly for that column. Clustering depth measures the average depth of these overlapping micro-partitions: the smaller it is, the better the table is clustered, and an empty table has a depth of zero. SYSTEM$CLUSTERING_INFORMATION reports it, but query performance remains the best indicator.

Clustering keys

A clustering key names columns or expressions, so that rows with similar values end up in the same micro-partitions. It is meant for very large tables, where queries filter on columns that do not follow the load order. Choose the columns that queries filter or join on, with a cardinality that is neither too low, like true or false, nor too high, like a unique I D. Keep it to three or four columns at most, and test representative queries before and after.

Automatic Clustering

Once a table has a clustering key, the Automatic Clustering service reclusters it in the background, as inserts and updates change it. It is serverless: you do not choose a warehouse, and Snowflake bills the credits that it uses. Reclustering also writes new micro-partitions, so it adds storage, including Time Travel and Fail-safe for the old ones. And ALTER TABLE with SUSPEND RECLUSTER pauses it, while RESUME RECLUSTER starts it again.

When not to cluster

Most tables never need a clustering key, because their natural clustering is good enough. Small tables, and tables whose queries already filter on the load order, gain very little. Clustering costs credits and storage, so add a key only when large scans hurt, and measure the result.

Recap

Let's recap. Every table is divided into compressed, columnar micro-partitions, in the order the rows arrive. Metadata such as value ranges lets queries prune the micro-partitions that cannot match. Overlapping ranges mean a deeper clustering depth, and poorer pruning. A clustering key co-locates similar rows, for very large tables, with three or four well-chosen columns at most. And Automatic Clustering keeps the table clustered on serverless compute, at a cost.

Quick checks for this lesson

The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.

  1. Foxglove loads its orders table every day, in date order, and a query that filters on a single order date reads very few micro-partitions. What makes this possible?

    • An index Snowflake built on order_date
    • The query result cache from an earlier run
    • Search optimization, on by default
    • Date ranges in micro-partition metadata
    Show the answer

    Date ranges in micro-partition metadata

    The range of dates in each micro-partition's metadata lets Snowflake skip all the others. “An index Snowflake built on order_date” is wrong, since Snowflake does not build indexes on standard tables by itself. “The query result cache from an earlier run” would apply only to an identical query that ran before. And “Search optimization, on by default” is a separate service that you must enable, and it is not needed here.

  2. Analysts filter Foxglove’s 6 TB orders table on the shipping country, which has about forty values, and the queries scan most micro-partitions. Which column is the best clustering key?

    • SHIP_COUNTRY, about forty values
    • ORDER_ID, unique for every row
    • IS_GIFT, true or false
    • ORDER_TS, to the millisecond
    Show the answer

    SHIP_COUNTRY, about forty values

    The shipping country is used in the filters, and its forty values group well into micro-partitions. “ORDER_ID, unique for every row” has a different value on every row, which makes clustering costly and pruning poor. “IS_GIFT, true or false” has only two values, which prunes very little. And “ORDER_TS, to the millisecond” is unique almost everywhere, so it is too costly as well.

  3. Foxglove adds a clustering key to its orders table. Which compute keeps the table clustered as new orders arrive?

    • The table owner’s default warehouse
    • The warehouse of the next user query
    • Serverless compute managed by Snowflake
    • None: reclustering is free metadata work
    Show the answer

    Serverless compute managed by Snowflake

    Automatic Clustering runs on serverless compute that Snowflake manages, and its credits are charged to the account. “The table owner’s default warehouse” is wrong, since you do not name a warehouse for reclustering. “The warehouse of the next user query” is wrong, because user queries do not recluster the table. And “None: reclustering is free metadata work” is wrong, since reclustering consumes credits and adds storage.