# Snowflake micro-partitions explained: pruning, clustering depth and Optima Clustering

Snowflake skips data by reading min and max values stored for every micro-partition. This guide shows, with a runnable simulation, how load order decides what a query scans, how to read clustering depth, and how Optima Clustering changes the cost of fixing it.

A Snowflake query is fast or slow mostly for one reason: how many micro-partitions it reads. Snowflake cuts every table into micro-partitions as data arrives and keeps a summary of each one, including the lowest and highest value of every column. When a query filters on a column, Snowflake compares the filter with those summaries and skips every micro-partition that cannot match. This is pruning, and skipped data costs nothing to scan.

Pruning works only when values queried together are stored together. That depends on load order, and it decays as late rows, updates and backfills mix the data. A clustering key tells Snowflake which order to restore, and Automatic Clustering does the work in the background for a fee. Since 1 September 2026 that service has a new engine for newly clustered tables, Optima Clustering, with different billing and longer key support.

This article builds the mechanism from scratch. A simulation of 3.65 million rows shows one late row per partition turning a one-day query from 1 partition read into 11. You will also learn to read SYSTEM$CLUSTERING_INFORMATION and work out when a key pays for itself. For the warehouse side of the bill, see [Snowflake virtual warehouses and credits](/articles/snowflake-warehouse-credits-sizing-auto-suspend).

## What happened

### Optima Clustering becomes the engine for newly clustered tables (1 September 2026)

Snowflake's Automatic Clustering documentation now describes two versions. From 1 September 2026, tables that get a clustering key for the first time use Optima Clustering. Tables already clustered stay on the older engine, now called Clustering Classic. There is no migration command, and changing the key with ALTER TABLE does not move a table to Optima.

The engines bill differently. Classic charges serverless compute credits for initial clustering and maintenance. Optima bills on uncompressed gigabytes ingested, multiplied by a per-GB rate and an overlap factor between 0 and 1. New data that arrives already in order has a factor near 0, so its cost approaches zero. Both appear under the Auto Clustering service type, and the VERSION column of AUTOMATIC_CLUSTERING_HISTORY says OPTIMA or CLASSIC.

### Clustering keys can use up to 1 KB of each value (1 September 2026)

Classic looks only at the first 5 bytes of each key column. Optima can use up to 1 KB across all key columns. Snowflake's launch post reports an internal table whose key values shared a five-character prefix: partitions pruned rose by more than 99% under Optima. It also reports that Block saw query execution time fall by over 90% on one table. These are company-reported results, and Snowflake says results vary.

Optima Clustering belongs to a wider set called Snowflake Optima. Optima Indexing, Optima Metadata and Optima Planning run on Gen2 standard and Adaptive warehouses at no extra cost. Optima Clustering is a paid, table-level feature that does not depend on warehouse type.

## How micro-partitions store data

Think of a micro-partition as a labelled box. Inside, rows are stored column by column. On the label, for every column, are the smallest value, the largest value and the number of distinct values. A worker looking for orders from 12 March reads labels, not boxes, and opens only the boxes whose date range includes 12 March.

Snowflake's documentation gives the rules. Each micro-partition holds between 50 MB and 500 MB of uncompressed data, stored smaller after compression. Snowflake creates micro-partitions automatically for all standard tables, in the order data is inserted or loaded. The metadata records each column's value range and number of distinct values, and columnar storage means a filter on one column does not read the others.

The ideal case is simple arithmetic. With one year of hourly data spread evenly, a query for one hour would ideally scan 1/8,760 of the micro-partitions, because 365 × 24 = 8,760 hours. A filter matching 10% of a column's range would ideally scan about 10%.

Two consequences follow. Pruning uses only the labels, so it is close to free. But the labels hold only a minimum and a maximum, so a single out-of-place row stretches the range of its whole micro-partition.

| Pattern | Prunes? | Why |
|---|---|---|
| `WHERE event_date = '2026-07-19'` | Yes | Literal compared with min and max |
| `WHERE event_date BETWEEN '2026-07-01' AND '2026-07-07'` | Yes | Range overlap test |
| `WHERE event_date = (SELECT MAX(d) FROM cal)` | No | Snowflake does not prune on subqueries, even constant ones |
| `WHERE customer_id = 123` on a date-ordered table | Rarely | Each partition spans many customers |
| `WHERE UPPER(country) = 'TR'` | Weakly | The function hides the range; Optima Metadata targets this pattern |

## A runnable simulation of pruning

The simulation creates 3,650,000 event rows, 10,000 per day for 365 days, and cuts them into micro-partitions of 10,000 rows. In a perfectly ordered table each day lands in one partition. Real micro-partitions are sized by bytes, not rows, but the range arithmetic is the same. This DuckDB version adds late rows: 5% carry an event day 1 to 30 days older than their load day.

```python
import duckdb  # tested with duckdb 2.0.1
con = duckdb.connect()
con.execute("""
CREATE TABLE events AS
SELECT i AS row_id,
       CAST(i*365/3650000 AS INTEGER)
         - CASE WHEN hash(i) % 100 < 5
                THEN 1 + CAST(hash(i*7) % 30 AS INTEGER) ELSE 0 END AS event_day,
       CAST(hash(i*13) % 50000 AS INTEGER) AS customer_id
FROM range(3650000) t(i);
""")
q = """
WITH zone AS (
  SELECT row_id // 10000 AS mp, MIN(event_day) AS lo, MAX(event_day) AS hi
  FROM {src} GROUP BY 1)
SELECT COUNT(*) AS total_mp,
       COUNT(*) FILTER (WHERE NOT (hi < 200 OR lo > 200)) AS scanned_for_day_200
FROM zone;"""
print(con.execute(q.format(src="events")).fetchall())
con.execute("""CREATE TABLE events_sorted AS
  SELECT row_number() OVER (ORDER BY event_day, row_id) - 1 AS row_id,
         event_day, customer_id FROM events""")
print(con.execute(q.format(src="events_sorted")).fetchall())
```

It prints `[(365, 32)]` in arrival order and `[(365, 2)]` after re-sorting. The `zone` CTE is what Snowflake keeps as metadata: one min and one max per partition. The `FILTER` clause is the pruning test: skip a partition only if its maximum is below the filter or its minimum above it.

Why 32? The partition loaded on day 215 may hold one late row dated day 200, so its range becomes 200 to 215 and it must be scanned. Almost every partition loaded in the following 30 days holds such a row. After the re-sort the answer is 2, because the shifted row counts make day 200 straddle a partition boundary.

### How little disorder it takes

A pure Python version of the same model varied the share of late rows and measured partitions scanned for day 200.

| Late rows | Late rows per partition | Partitions scanned for one day | Average range width (days) |
|---|---|---|---|
| 0% | 0 | 1 | 0.00 |
| 0.01% | 1 | 11 | 11.41 |
| 0.1% | 10 | 29 | 26.20 |
| 1% | 100 | 31 | 28.68 |
| 5% | 500 | 31 | 28.73 |

```chart
{"type": "line", "title": "Partitions scanned for a one-day filter as late rows grow", "x": ["0%", "0.01%", "0.1%", "1%", "5%", "20%"], "series": [{"name": "partitions scanned (of 365)", "data": [1, 11, 29, 31, 31, 31]}], "xlabel": "share of rows that arrive up to 30 days late", "ylabel": "partitions scanned", "note": "Computed in this article's Python simulation: 3,650,000 rows, 365 partitions of 10,000 rows, query on day 200"}
```

One late row per partition, a rate of 1 in 10,000, multiplies the scan by 11. At 0.1% the damage is nearly complete, because ranges are as wide as the 30-day lateness window allows. Min/max metadata does not degrade gently: it is either tight or it is not.

### When the filter is on the wrong column

The same model measured four load orders for three queries.

| Load order | One day | Seven days | One customer | Average depth on event_day |
|---|---|---|---|---|
| Arrival order, no late rows | 1 | 7 | 365 | 1.00 |
| Arrival order, 5% late rows | 31 | 37 | 365 | 31.00 |
| Fully shuffled | 365 | 365 | 365 | 365.00 |
| Sorted by customer_id | 365 | 365 | 1 | 365.00 |

```chart
{"type": "bar", "title": "Partitions scanned by load order and filter", "x": ["arrival", "arrival + 5% late", "shuffled", "sorted by customer"], "series": [{"name": "one-day filter", "data": [1, 31, 365, 365]}, {"name": "one-customer filter", "data": [365, 365, 365, 1]}], "xlabel": "how the 3.65M rows were loaded", "ylabel": "partitions scanned of 365", "note": "Computed in this article's Python simulation"}
```

A table has one physical order. Sorting by date makes date filters cheap and customer filters expensive. The clustering key should follow the filter of your most expensive, most frequent queries. For selective point lookups on other columns, Snowflake offers the search optimization service.

## Reading clustering depth and overlap

Snowflake measures this disorder with two numbers. Overlap counts how many other micro-partitions have value ranges overlapping each one on the chosen columns. Clustering depth, in the documentation's words, is the average depth of overlapping micro-partitions. It is 1 or more for a populated table, 0 for an empty one, and smaller is better. When no ranges overlap, micro-partitions are in a constant state and clustering cannot improve them.

In the simulation, the ordered table has depth 1.00 and no overlaps. With 5% late rows each day is covered by about 31 partitions, so depth is 31.00 and the average partition overlaps 57.45 others. In the shuffled table every partition spans the year, so depth equals the partition count. Our depth is a simplified version of Snowflake's calculation, but it moves the same way.

```sql
-- Use the table's defined clustering key
SELECT SYSTEM$CLUSTERING_INFORMATION('analytics.events');
-- Test a candidate key on a table that has none
SELECT SYSTEM$CLUSTERING_INFORMATION('analytics.events', '(TO_DATE(event_ts))');
```

| Field | Meaning |
|---|---|
| `version` | CLASSIC or OPTIMA, which sets the billing model |
| `total_partition_count` | Micro-partitions; shown as 2 million for larger, sampled tables |
| `total_constant_partition_count` | Partitions that cannot improve; not available for Optima |
| `average_overlaps` | Overlapping partitions per partition; high means poor clustering |
| `average_depth` | Average overlap depth; compare with the partition count |
| `partition_depth_histogram` | Partitions per depth bucket (0 to 16, then 32, 64, 128...); not for Optima |
| `clustering_errors`, `notes` | Recent service errors and Snowflake's suggestions |

Snowflake's example output shows 1,156 partitions, 0 constant partitions, average overlaps of 117.5484 and average depth of 64.0701, which the documentation reads as poorly clustered. It also cautions that depth is not an absolute measure: query performance is the real test. Read partitions scanned against partitions total in the query profile. On Gen2 and Adaptive warehouses the profile also shows "Partitions pruned by Snowflake Optima".

## Choosing a clustering key and paying for it

Snowflake's guidance lines up with the simulation:

1. **Filter columns first.** Selective filter columns, usually a date, come first; join columns next if there is room. GROUP BY and ORDER BY columns help less.
2. **Keep it short.** Use at most 3 or 4 columns or expressions; more tends to add cost faster than benefit.
3. **Aim for middle cardinality.** A Boolean barely prunes; a nanosecond timestamp is costly to keep ordered. Use `TO_DATE(event_ts)` or `TRUNC` with a negative scale.
4. **Low to high cardinality.** A high-cardinality first column makes later columns nearly useless.
5. **Mind text prefixes.** For Classic, cluster on a substring after a shared prefix, such as `SUBSTRING(vc, 5, 5)`.

```sql
CREATE TABLE analytics.events (
  event_ts TIMESTAMP_NTZ, tenant_id NUMBER, event_type VARCHAR, payload VARIANT
) CLUSTER BY (TO_DATE(event_ts), tenant_id);

ALTER TABLE analytics.events CLUSTER BY (TO_DATE(event_ts), tenant_id);  -- change key
ALTER TABLE analytics.events SUSPEND RECLUSTER;                           -- pause
ALTER TABLE analytics.events DROP CLUSTERING KEY;                         -- stop for good

SELECT SYSTEM$ESTIMATE_AUTOMATIC_CLUSTERING_COSTS('analytics.events',
                                                   '(TO_DATE(event_ts), tenant_id)');
```

Some behaviours surprise teams. CREATE TABLE AS SELECT does not copy the key. A clone copies it but starts with Automatic Clustering suspended. Hybrid tables cannot have keys. For CSV loads with COPY INTO, functions such as DATE_TRUNC in the key cause a compilation error; Parquet, JSON, Avro and ORC are not affected.

Costs come from three places. Compute: Classic bills serverless credits, Optima bills per GB ingested times the overlap factor. Storage: reclustering writes new micro-partitions and keeps the old ones for Time Travel and Fail-safe, at least 8 days and up to 97 days with extended Time Travel on Enterprise Edition or higher. Control: resource monitors cannot cap the AUTOMATIC_CLUSTERING warehouse.

The estimate function returns an `initial` one-time cost and a daily `maintenance` cost from the past week of DML. Its sample output shows about 98.2 credits initial and 10.0 credits a day. Snowflake warns actual costs can differ by up to 100%, occasionally several times, and for Optima tables it estimates only one-time costs.

A worked break-even uses those sample figures. A dashboard query on a Medium warehouse (4 credits an hour) runs 400 times a day at 30 seconds: 400 × 30 = 12,000 seconds = 3.33 hours = 13.3 credits a day. If clustering cuts it to 5 seconds, cost falls to 400 × 5 / 3,600 × 4 = 2.2 credits, saving 11.1 a day. Net of 10.0 maintenance that is 1.1 credits a day, so the 98.2 initial credits take about 89 days to recover. Double the query count and the case is clear; halve it and clustering loses money. The runtimes are illustrative assumptions, and savings appear only if the warehouse suspends sooner; the [Snowflake warehouse sizing simulation](/ai-simulations/snowflake-warehouse-sizing) tests that part.

Under Optima, new data arriving in key order, such as a date key on an append-only stream, keeps the overlap factor near 0. New data landing across the whole key range raises it.

## Use cases and examples

**Event analytics with late mobile events.** A product team loads app events every 15 minutes into a 6 TB table; offline mobile clients send some events days late. Dashboards filter on the last 7 days and scan far more partitions than expected, because 1 late row in 10,000 widens every range. A key on `TO_DATE(event_ts)` fixes it, and since fresh loads are nearly ordered the Optima overlap factor stays low. The team compares SYSTEM$CLUSTERING_INFORMATION before and after.

**Multi-tenant SaaS reporting.** Usage rows for 3,000 tenants share one table, and every report filters on tenant and date. The key `(TO_DATE(event_ts), tenant_id)` follows the order rule, since a year has 365 dates against 3,000 tenants. Running the estimate function several times on both column orders gives finance a credit range for the break-even sum.

**Invoice lookups with a shared prefix.** Invoice numbers look like `INV-2026-0004812`. On Classic a raw key sees only `INV-2`, so pruning fails; `SUBSTRING(invoice_no, 10, 7)` keys on `0004812` instead. Newly clustered tables on Optima use up to 1 KB of the value. For single-invoice lookups, the search optimization service (Enterprise Edition or higher) usually beats any key.

**A backfill that shuffled the table.** A team reloads two years of history with one INSERT ... SELECT ordered by customer. Date depth jumps to the partition count, like the "sorted by customer" row, and dashboards slow sharply. Rewriting the backfill with `ORDER BY event_ts` makes partitions born in date order. The same idea appears as file statistics in [Delta Lake](/articles/delta-lake-transaction-log-explained) and manifest statistics in [Apache Iceberg](/articles/apache-iceberg-metadata-tree-snapshots).

**A small dimension table.** A 40 MB product table fits in one or two micro-partitions, so there is nothing to prune and a key only adds cost.

## What it means in practice

Most slowdowns blamed on warehouse size are pruning problems: the warehouse reads partitions it should skip. Before scaling up, compare partitions scanned with partitions total. "Mostly sorted" is not enough, because a partition's range is set by its worst row. A clustering key tells Snowflake which order to restore after drift.

Optima shifts the economics for new tables. The bill follows how much data you ingest and how disordered it is, which should make time-keyed, append-heavy tables cheaper to keep clustered. Pruning drives cost in other engines too: BigQuery bills bytes scanned, as the [BigQuery partition pruning simulation](/ai-simulations/bigquery-partition-pruning-bytes-scanned) shows. For wider context see [storage and formats](/topics/big-data/storage-and-formats) and [query engines](/topics/big-data/engines).

## What to do now

1. **Rank tables by query cost.** Start with tables whose selective queries burn the most warehouse time, not the biggest tables.
2. **Read the query profile.** Partitions scanned close to partitions total on a selective filter is the signal to act.
3. **Save a baseline.** Store SYSTEM$CLUSTERING_INFORMATION output for the candidate key to compare later.
4. **Fix load order first.** Add `ORDER BY` on the filter column to backfills and batch loads.
5. **Choose a short, coarse key.** Three or four expressions at most, lowest cardinality first.
6. **Estimate several times.** Average SYSTEM$ESTIMATE_AUTOMATIC_CLUSTERING_COSTS runs and plan for double.
7. **Do the break-even sum.** Compare maintenance credits with warehouse credits saved, plus retained storage.
8. **Check the engine.** The `version` field tells you whether a table bills as Classic or Optima.
9. **Review monthly.** Query AUTOMATIC_CLUSTERING_HISTORY per table and drop keys that no longer pay.

## Risks and open questions

**Estimates can be far off.** Snowflake says clustering estimates can miss by up to 100%, occasionally several times. Validate with weeks of real history.

**Optima maintenance is not yet estimable.** The function covers only one-time Optima costs, and the pages cited here do not publish the per-GB rate.

**Suspending is not a cost switch under Optima.** Resuming applies a catch-up cost; dropping the key is the way to stop paying.

**Mixed estates persist.** Existing tables stay on Classic indefinitely, so large accounts will run two billing models side by side.

**Watch next:** Optima maintenance estimates in the cost function, general availability of automatic key selection (a key set to AUTO, private preview per Snowflake's launch post), and any Classic-to-Optima migration path.

## Frequently asked questions

### Can I create partitions myself in Snowflake?

No. Snowflake creates micro-partitions automatically in load order. You influence layout by loading in a useful order or by defining a clustering key for Automatic Clustering to maintain.

### How big is a micro-partition?

Each holds between 50 MB and 500 MB of uncompressed data, according to Snowflake's documentation. Stored size is smaller because each column is compressed.

### What is a good clustering depth?

Smaller is better, with 1 the ideal for a populated table. Depth is not an absolute measure, so compare it with the partition count and check partitions scanned for the queries you care about.

### Should every large table have a clustering key?

No. Snowflake recommends clustering for multi-terabyte tables with selective, repeated filters on the same columns and many more queries than DML. Tables that arrive in query order often need no key.

### What is the difference between Optima Clustering and Clustering Classic?

Optima is the engine for tables clustered for the first time from 1 September 2026. It bills on uncompressed data ingested times an overlap factor, not compute hours, and uses up to 1 KB of key data instead of 5 bytes per column. Existing clustered tables stay on Classic.

## Summary

Snowflake prunes by comparing filters with each micro-partition's stored minimum and maximum, so storage order decides what a query reads. In our 3.65-million-row simulation a one-day filter read 1 of 365 partitions when ordered, 11 when 1 row in 10,000 arrived late, 31 when late rows were common and all 365 when sorted on another column. SYSTEM$CLUSTERING_INFORMATION measures that disorder, a short coarse key tells Automatic Clustering what to restore, and the cost estimate plus a break-even sum shows whether it pays. Newly clustered tables now use Optima Clustering. More on the platform is on the [Snowflake tool page](/tools/snowflake).

## Sources

- [Snowflake Documentation: Micro-partitions and data clustering](https://docs.snowflake.com/en/user-guide/tables-clustering-micropartitions)
- [Snowflake Documentation: Clustering keys and clustered tables](https://docs.snowflake.com/en/user-guide/tables-clustering-keys)
- [Snowflake Documentation: Automatic Clustering](https://docs.snowflake.com/en/user-guide/tables-auto-reclustering)
- [Snowflake Documentation: SYSTEM$CLUSTERING_INFORMATION](https://docs.snowflake.com/en/sql-reference/functions/system_clustering_information)
- [Snowflake Documentation: SYSTEM$ESTIMATE_AUTOMATIC_CLUSTERING_COSTS](https://docs.snowflake.com/en/sql-reference/functions/system_estimate_automatic_clustering_costs)
- [Snowflake Documentation: Snowflake Optima](https://docs.snowflake.com/en/user-guide/snowflake-optima)
- [Snowflake Blog: Snowflake Optima Clustering, speed and predictable costs](https://www.snowflake.com/en/blog/engineering/introducing-snowflake-optima-clustering/)
- [Snowflake Documentation: Search optimization service](https://docs.snowflake.com/en/user-guide/search-optimization-service)
