CertSafari
    Snowflake SnowPro Core Certification (COF-C03)· Lessons

    Domain 1 · Lesson 5/19

    Micro-partitions, pruning and clustering in Snowflake

    Explain Snowflake storage concepts

    15 min read
    5.17% of exam
    3 sources
    Published 20 Oct 2026
    Docs as of 18 Oct 2026

    What you will be able to do

    • Describe how Snowflake physically stores a table as compressed, columnar micro-partitions and what metadata it keeps about each one
    • Explain how pruning uses micro-partition metadata and columnar storage to skip data, and which predicates cannot prune
    • Interpret clustering depth and use SYSTEM$CLUSTERING_INFORMATION to measure it
    • Decide when a clustering key is worth its compute and storage cost, and choose key columns by cardinality

    Key concept

    Micro-partition — The physical unit that every Snowflake table is automatically divided into: a contiguous block holding 50 to 500 MB of uncompressed data, stored column by column, with metadata such as each column's value range. Pruning and clustering both work by reasoning about these units.

    1.How Snowflake stores a table: micro-partitions

    Every Snowflake table is physically a set of micro-partitions, whatever its rows and columns look like logically. Snowflake creates them automatically as data is inserted or loaded, following the order in which the rows arrive. Nobody defines partitions up front or maintains them later. That is the main break from traditional warehouses, which manage static partitions with their own DDL and suffer from maintenance overhead and data skew that leaves partitions very different in size.

    Each micro-partition holds between 50 MB and 500 MB of uncompressed data, and takes up less than that on disk because Snowflake always stores data compressed. Data inside a micro-partition is not stored row by row. Each column is stored and compressed independently, and Snowflake picks the most efficient compression algorithm for each column in each micro-partition. Because the units are small and roughly uniform in size, a large table can contain millions or even hundreds of millions of them, and skew does not build up. Micro-partitions can overlap in the ranges of values they hold, which also helps prevent skew.

    Snowflake also keeps metadata about the rows in every micro-partition: the range of values in each column, the number of distinct values, and other properties used for optimisation. The rest of this page builds on that metadata. It also makes some DML very cheap: deleting all rows from a table is a metadata-only operation. Dropping a column does not rewrite the micro-partitions that hold it, so the dropped column's data stays in storage.

    Snowflake does not edit micro-partitions in place. When data is reorganised, Snowflake writes new micro-partitions, marks the old ones as deleted, and keeps them for Time Travel and Fail-safe. Time Travel lets you query, clone or restore a table as it was within its retention period; Fail-safe is a further, fixed 7-day period that follows it. The two add up to the purge window for the old micro-partitions: 1 day of Time Travel plus 7 days of Fail-safe gives the 8-day minimum, and 90 days of extended Time Travel (Enterprise Edition or higher) plus 7 gives 97. Adding even a few rows can cause every micro-partition that contains those values to be recreated. This is why reorganising a table costs storage as well as compute.

    Checkpoint 1 of 8· Check yourself

    A data engineer is moving a large sales table from a traditional data warehouse to Snowflake. They ask how they should set up and maintain the table's partitions in Snowflake. What is the correct answer?

    Checkpoint 2 of 8· Exam question

    An architect wants to explain how Snowflake physically stores a large fact table on disk. Which statement correctly describes the storage layer?

    Sources123

    2.Pruning: skipping micro-partitions, then columns

    Pruning is how Snowflake uses micro-partition metadata to avoid reading data. It happens in two stages. First, Snowflake compares the query's filter with each micro-partition's value range for the filtered column and skips any micro-partition whose range cannot contain a match. Second, inside the micro-partitions that remain, it scans only the columns the query references. Ideally pruning is proportional: a filter that selects 10% of a value range should scan about 10% of the micro-partitions. The closer the scanned fraction is to the fraction of data actually selected, the better the pruning.

    Take a BI dashboard that filters an orders table on order_date and selects three of its forty columns. Snowflake never opens micro-partitions whose order_date range falls outside the filter. In the rest, it reads three columns and ignores the other thirty-seven. A SELECT * with no filter has to read every micro-partition and every column. Both queries run on the same table with the same warehouse. The filtered query is faster only because it reads less storage.

    Pruning also works on columns that hold semi-structured data. For time-series tables, it can return results in under a second for slices as small as an hour. Some predicates cannot prune, though. Snowflake does not prune on a predicate that contains a subquery, even when the subquery returns a constant. A date bound written as a literal can skip micro-partitions. The same bound looked up with a subquery cannot.

    Checkpoint 3 of 8· Check yourself

    Two dashboard queries read the same large orders table. Query A filters with WHERE order_date >= '2024-06-01'. Query B filters with WHERE order_date >= (SELECT MAX(cutoff_date) FROM etl_control), and that subquery always returns a single date. Which statement about micro-partition pruning is correct?

    Checkpoint 4 of 8· Exam question

    A BI dashboard runs a query that filters an orders table on order_date and selects only three of its forty columns. Why does this query typically complete faster than a SELECT * with no filter, even though both touch the same table?

    Sources1

    3.Clustering depth: measuring how much micro-partitions overlap

    Pruning only works when micro-partitions hold narrow, separate value ranges. If every micro-partition's order_date range covers the whole year, no date filter can skip any of them. Data is usually loaded along natural dimensions such as date or region, so tables often start out well clustered. A table loaded out of order, or changed heavily by DML, loses that ordering, and very large tables suffer the most.

    Snowflake keeps clustering metadata for each table: the total number of micro-partitions, how many of them overlap in value range for a given set of columns, and how deep that overlap goes. Clustering depth counts how many micro-partitions overlap at a given value of the specified columns, averaged across the table. It is 1 or greater for a populated table, and smaller is better. An empty table has a depth of 0. When no micro-partitions overlap in range, they are in a constant state, and clustering cannot improve them further. In a real large table, every micro-partition reaching that state is neither likely nor needed for good performance.

    Take three micro-partitions with order_date ranges of 1–31 January, 1–28 February and 1–31 March. No date falls in more than one range, so a filter on any single date has exactly one micro-partition to read: depth 1, the lowest a populated table can have. Now suppose each of the three covers 1 January to 31 March. Every date falls in all three ranges, so a filter on a single day cannot skip any of them: depth 3. Clustering depth rises as overlap grows and falls as overlap shrinks, which is why a low average means date filters can prune.

    Depth has two uses. It lets you track a large table's clustering health over time as DML changes it, and it helps you decide whether the table would benefit from an explicit clustering key. It is only an approximate measure. Query performance is the real test: if queries still perform as expected, the table is probably well clustered. If they get slower over time, it probably is not, and clustering may help.

    The system function SYSTEM$CLUSTERING_INFORMATION calculates clustering details, including depth, for any columns of any table, whether or not the table has a clustering key. For a table with a clustering key, the table name is the only argument it needs. For a table without a key, or to measure columns other than the key, pass those columns as an extra argument.

    Checkpoint 5 of 8· Check yourself

    You run SYSTEM$CLUSTERING_INFORMATION on the event_date column of three tables. Table X reports a clustering depth of 0, table Y reports 1.5 and table Z reports 35. None of them has a clustering key. Which reading is correct?

    Sources12

    4.Clustering keys and automatic reclustering

    A clustering key is one or more columns or expressions that Snowflake uses to keep matching rows together in the same micro-partitions. Snowflake recommends at most 3 or 4 per key. Clustering keys are meant for very large tables that were loaded in a poor order or whose natural clustering has degraded through DML. Two signs suggest a table needs one: queries are slower than expected or getting slower, and the clustering depth is large.

    You define a key with a CLUSTER BY clause on CREATE TABLE, or add it later with ALTER TABLE, and you can change or drop it at any time. After that there is nothing to schedule. Snowflake reclusters automatically: it deletes the affected rows and re-inserts them grouped by the key, and only does so when the table will benefit. Materialized views can be clustered too, under mostly the same rules.

    A clustering key built from expressions: TO_DATE reduces a timestamp to one value per day, and a substring caps a long stringsql
    CREATE OR REPLACE TABLE t2 (c1 timestamp, c2 STRING, c3 NUMBER) CLUSTER BY (TO_DATE(C1), substring(c2, 0, 10));

    Clustering is not free, so most tables should not have a key. Reclustering uses credits, and the amount depends on the table's size and how much data needs reorganising. It also adds storage, because every pass writes new micro-partitions and keeps the old ones for Time Travel and Fail-safe. Those old micro-partitions are purged only after a minimum of 8 days, or up to 97 days with extended Time Travel. A good candidate meets all of these conditions:

    • It holds a large number of micro-partitions, which usually means multiple terabytes.
    • Its queries are selective or sort the data.
    • Most queries filter or sort on the same few columns.
    • It is queried often and changed rarely. If DML is heavy, group it into large, infrequent batches.

    Pick key columns by how they are used and by cardinality. Start with columns used in selective filters, such as the date column in a fact table queried by date range, then add columns used in joins. Avoid both extremes of cardinality. A Boolean such as IS_NEW_CUSTOMER allows very little pruning. A nanosecond timestamp has so many distinct values that rows cannot be grouped well, and keeping it clustered is expensive. For a high-cardinality column, cluster on an expression that keeps the original ordering but has fewer distinct values, such as TO_DATE of a timestamp.

    Consider a 50 TB events table that is loaded continuously, where an upstream change means rows no longer arrive in event_timestamp order. Each new micro-partition covers a wide range of timestamps, overlap grows, and pruning gets worse. The fix is a clustering key on the timestamp, ideally an expression such as TO_DATE(event_timestamp), so that automatic clustering reorganises the micro-partitions and reduces overlap. A bigger loading warehouse would not help, because micro-partitions follow the order in which rows arrive. Changing the table type would not help either.

    Checkpoint 6 of 8· Fill the gap

    Column c1 holds high-cardinality timestamp values. Which function goes in the blank so the clustering key keeps c1's original ordering but has far fewer distinct values?

    CREATE OR REPLACE TABLE t2 (c1 timestamp, c2 STRING, c3 NUMBER) CLUSTER BY ( ? (C1), substring(c2, 0, 10));

    Checkpoint 7 of 8· Check yourself

    Automatic clustering would run on each of these tables. Which one is the best candidate for a clustering key?

    Checkpoint 8 of 8· Exam question

    A 50 TB events table is loaded continuously and most analytical queries filter on event_timestamp, but new rows no longer arrive in timestamp order because of a change in the upstream pipeline. Query pruning has degraded noticeably. What should the team do?

    Sources2

    Sources

    (3)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “Each micro-partition contains between 50 MB and 500 MB of uncompressed data”
      ↩︎ How Snowflake stores a table: micro-partitions
      “Tables are transparently partitioned using the ordering of the data as it is inserted/loaded.”
      ↩︎ How Snowflake stores a table: micro-partitions
      “Columns are stored independently within micro-partitions, often referred to as columnar storage.”
      ↩︎ How Snowflake stores a table: micro-partitions
      “Snowflake automatically determines the most efficient compression algorithm for the columns in each micro-partition.”
      ↩︎ How Snowflake stores a table: micro-partitions
      “some operations, such as deleting all rows from a table, are metadata-only operations.”
      ↩︎ How Snowflake stores a table: micro-partitions
      “The range of values for each of the columns in the micro-partition.”
      ↩︎ Pruning: skipping micro-partitions, then columns
      “only the columns referenced by a query are scanned.”
      ↩︎ Pruning: skipping micro-partitions, then columns
      “Snowflake does not prune micro-partitions based on a predicate with a subquery, even if the subquery results in a constant.”
      ↩︎ Pruning: skipping micro-partitions, then columns
      “The smaller the average depth, the better clustered the table is with regards to the specified columns.”
      ↩︎ Clustering depth: measuring how much micro-partitions overlap
      “The number of micro-partitions containing values that overlap with each other (in a specified subset of table columns).”
      ↩︎ Clustering depth: measuring how much micro-partitions overlap
      “As the number of overlapping micro-partitions decreases, the overlap depth decreases.”
      ↩︎ Clustering depth: measuring how much micro-partitions overlap
      “A table with no micro-partitions (i.e. an unpopulated/empty table) has a clustering depth of 0.”
      ↩︎ Clustering depth: measuring how much micro-partitions overlap
      “If query performance degrades over time, the table is likely no longer well-clustered and may benefit from clustering.”
      ↩︎ Clustering depth: measuring how much micro-partitions overlap
      “Each micro-partition contains between 50 MB and 500 MB of uncompressed data”
      ↩︎ Key concept
      “Snowflake does not prune micro-partitions based on a predicate with a subquery, even if the subquery results in a constant.”
      ↩︎ Exam trap 1
      “The smaller the average depth, the better clustered the table is with regards to the specified columns.”
      ↩︎ Exam trap 2
      “In contrast to traditional static partitioning, Snowflake micro-partitions are derived automatically; they don’t need to be explicitly defined up-front or maintained by users.”
      ↩︎ Checkpoint
      “a query targeting a particular hour would ideally scan 1/8760th of the micro-partitions in the table”
      ↩︎ Prediction
    2. 2.
      “Adding even a small number of rows to a table can cause all micro-partitions that contain those values to be recreated.”
      ↩︎ How Snowflake stores a table: micro-partitions
      “minimum of 8 days and up to 97 days for extended Time Travel”
      ↩︎ How Snowflake stores a table: micro-partitions
      “This function can be run on any columns on any table, regardless of whether the table has an explicit clustering key”
      ↩︎ Clustering depth: measuring how much micro-partitions overlap
      “For most tables, Snowflake recommends a maximum of 3 or 4 columns (or expressions) per key.”
      ↩︎ Clustering keys and automatic reclustering
      “Snowflake only performs automated maintenance if the table will benefit from the operation.”
      ↩︎ Clustering keys and automatic reclustering
      “minimum of 8 days and up to 97 days for extended Time Travel”
      ↩︎ Clustering keys and automatic reclustering
      “clustering is generally most cost-effective for tables that are queried frequently and do not change frequently.”
      ↩︎ Clustering keys and automatic reclustering
      “A column with very low cardinality might yield only minimal pruning”
      ↩︎ Clustering keys and automatic reclustering
      “defining the key as an expression on the column, rather than on the column directly, to reduce the number of distinct values.”
      ↩︎ Clustering keys and automatic reclustering
      “Clustering keys are not intended for all tables due to the costs of initially clustering the data and maintaining the clustering.”
      ↩︎ Exam trap 3
    3. 3.
      “Within the retention period, all Time Travel operations can be performed on data in the table”
      ↩︎ How Snowflake stores a table: micro-partitions
      “When a permanent table is deleted, it enters Fail-safe for a 7-day period.”
      ↩︎ How Snowflake stores a table: micro-partitions

    Continue to part 2 of 2

    Snowflake table types and view types

    Spotted a mistake, or was something unclear? Tell us.