Define a Snowflake clustering key on a large table, monitor micro-partition pruning efficiency, and control automatic clustering cost
domain: docs.snowflake.com/en/user-guide/tables-clustering-micropartitions · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗
Steps
Identify the columns used most frequently in WHERE and JOIN predicates for a large table and define a clustering key: ALTER TABLE orders CLUSTER BY (order_date, region)
Check the current clustering depth and overlap before and after: SELECT SYSTEM$CLUSTERING_INFORMATION('orders', '(order_date, region)') — returns average_depth and average_overlaps metrics
Monitor query pruning efficiency in the query profile: look for 'Partitions scanned' vs 'Partitions total' in query details — high pruning ratio confirms the clustering key is effective
Snowflake's Automatic Clustering service reclusters the table in the background; it incurs compute credit consumption visible in the Automatic Clustering billing line
Suspend automatic clustering on a table to stop incurring cost: ALTER TABLE orders SUSPEND RECLUSTER
Resume or drop the clustering key: ALTER TABLE orders RESUME RECLUSTER or ALTER TABLE orders DROP CLUSTERING KEY
Known gotchas
Automatic Clustering is a paid service charged in Snowflake credits based on compute used for reclustering merges — enable it only on tables where query pruning benefits outweigh the ongoing reclustering cost
Defining a clustering key on a table with very low cardinality (e.g. a boolean column) provides no pruning benefit; choose high-cardinality columns that are frequently used as filters
The SYSTEM$CLUSTERING_INFORMATION function returns an estimate — average_depth values above 1 indicate overlapping micro-partitions and signal poor clustering that benefits from recluster operations
Give your agent this knowledge — and 15,500+ more routes
One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?