
Proper use of partition pruning can dramatically reduce the amount of data Snowflake needs to scan resulting in faster queries and lower costs.

Proper use of partition pruning can dramatically reduce the amount of data Snowflake needs to scan, resulting in faster queries and lower costs.
Snowflake stores data in micro-partitions (50-500MB). Partition pruning skips irrelevant partitions based on query filters, scanning only necessary data.
-- GOOD: Enables pruning
SELECT * FROM orders
WHERE order_date = '2024-01-15';
-- Scans only partitions containing Jan 15 data
-- BAD: Prevents pruning
SELECT * FROM orders
WHERE YEAR(order_date) = 2024;
-- Functions on filter columns prevent pruning
-- Scans ALL partitions
-- BAD
WHERE YEAR(date_column) = 2024
WHERE UPPER(name_column) = 'JOHN'
WHERE date_column + INTERVAL '1 day' = '2024-01-16'
-- GOOD
WHERE date_column >= '2024-01-01' AND date_column < '2025-01-01'
WHERE name_column = 'JOHN' -- Store as uppercase if needed
WHERE date_column = '2024-01-15'
ALTER TABLE large_table
CLUSTER BY (date_column, category);
-- Queries filtering on these columns benefit from pruning
-- Check partitions scanned in query profile
SELECT
QUERY_ID,
PARTITIONS_SCANNED,
PARTITIONS_TOTAL,
(PARTITIONS_SCANNED / PARTITIONS_TOTAL * 100) as PERCENT_SCANNED
FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY
WHERE QUERY_TEXT LIKE '%my_large_table%'
ORDER BY START_TIME DESC
LIMIT 10;
A query on 10TB table with WHERE YEAR(order_date) = 2024 scanned all 10,000 partitions (10TB), took 60 seconds, cost 8 credits.
After changing to WHERE order_date >= '2024-01-01' AND order_date < '2025-01-01': Scanned 1,200 partitions (1.2TB, 88% reduction), took 7 seconds (8.5x faster), cost 1 credit (87% reduction).
Uncover hidden inefficiencies and start reducing Snowflake spend in minutes no disruption, no risk.