Snowflake Cost Optimization: 7 Techniques That Actually Cut the Bill
Warehouse sizing, auto-suspend, clustering, ACCOUNT_USAGE queries, and resource monitors. Estimate the bill from usage before you change prod.
By Dinesh ChandraSenior Data and AI Engineer · SnowPro certified- 1.Most overspend is idle warehouse time, so auto-suspend at 60 seconds comes before any resize.
- 2.Ten query patterns usually own a large share of the bill. Find them in QUERY_HISTORY before you touch a warehouse size.
- 3.Resource monitors should notify long before they suspend, and every warehouse needs one.
- 4.Attribution beats austerity. A tagged warehouse with a named owner gets optimized; an anonymous one grows forever.
- 5.Clustering and Search Optimization cost credits to maintain. Use them only on the tables that earn it.
Table of contents
- 1. Aggressive auto-suspend
- 2. Find out where the money goes
- Group by query shape, not query_id
- 3. Right-size warehouses (start small)
- 4. Separate workloads
- 5. Cluster only your biggest tables
- 6. Kill zombie schedules
- 7. Set resource monitors
- Query tags and a hard timeout
- Result cache is not a strategy
- COPY and Snowpipe are not “free compute”
- Time Travel and storage
- The habit that matters
- What I watch after a change
- Pitfalls
- FAQ
- What this means for your pipelines
Snowflake bills compute by the second while a virtual warehouse is running. That means most cost savings don’t require fancy vendor tools or enterprise add-ons. They come from running less time, on smaller warehouses, with smarter query pruning.
The Snowflake Cost Mental Model (In Plain English)
Think of a Snowflake warehouse like a taxi meter. You aren’t paying for how much data you store (storage is cheap, like flat-rate parking). You are paying for every second the taxi engine is turned on and idling. If your taxi sits in traffic or waits at the curb with the engine running for 10 minutes after dropping you off, you’re paying full price for that idle noise. Our goal is simple: turn off the engine the moment the query finishes, and pick a compact sedan instead of an 18-wheeler when hauling a couple of suitcases.
Here is a quick summary of the seven tactics and their typical impact:
| Strategy | Difficulty | Expected Bill Reduction | What it Does |
|---|---|---|---|
| 1. Auto-Suspend to 60s | Easy (2 minutes) | 15% to 35% | Stops paying for idle compute when queries finish |
| 2. Account Usage Auditing | Easy (5 minutes) | Visibility | Pinpoints exact queries & users burning credits |
| 3. Warehouse Right-Sizing | Medium (15 minutes) | 20% to 50% | Scales down oversized warehouses (e.g. XL → Medium) |
| 4. Spilling & Memory Fixes | Medium (30 minutes) | 10% to 25% | Eliminates disk-spill slowdowns and runaway joins |
| 5. Partition Pruning | Medium (30 minutes) | 15% to 40% | Scans only the needed micro-partitions instead of entire tables |
| 6. Hard Spend Limits (Monitors) | Easy (5 minutes) | Prevents disasters | Automatically halts runaway warehouses before budget overflows |
| 7. Storage & Time-Travel Cleanup | Medium (20 minutes) | 5% to 15% | Trims 90-day retention on staging/scratch tables |
flowchart LR
query[Incoming Query] --> warehouse[Warehouse Compute Meter]
warehouse --> suspend[Auto-suspend at 60s: Saves Idle $$]
warehouse --> size[Right-Size Warehouse: Halves Credit Rate]
query --> pruning[Partition Pruning: Scans 90% Less Data]
warehouse --> monitor[Resource Monitors: Hard Circuit Breaker]
1. Aggressive auto-suspend
The default 10-minute auto-suspend burns money on idle time. For most ELT warehouses, 60 seconds is right:
alter warehouse transforming set
auto_suspend = 60
auto_resume = true;
The trade-off is losing the warehouse data cache on suspend. Keep a longer suspend (5 to 10 minutes) only on BI warehouses where the same dashboard SQL repeats all morning.
If a warehouse never suspends, someone left a session or a tool holding
it. QUERY_HISTORY will show you.
New warehouses keep appearing with the 600-second default, so find the ones still on a long fuse:
select warehouse_name, auto_suspend, auto_resume, warehouse_size
from snowflake.account_usage.warehouses
where deleted_on is null
and auto_suspend > 120
order by auto_suspend desc;
Create new warehouses with initially_suspended = true so they do not
bill from the moment they exist.
The objection is always cold-start latency. Resume is typically a second or two, and the cache you lose usually costs less than the idle time you pay to keep it. The exception is a warehouse serving a dashboard that fires every few minutes all day. Keep that one warm, but do it deliberately and write down why.
Quantify idle time before and after, so the win is visible:
-- Approximate idle ratio per warehouse: metered credits vs. hours with query activity.
with metered as (
select warehouse_name, sum(credits_used) as credits
from snowflake.account_usage.warehouse_metering_history
where start_time > dateadd('day', -14, current_timestamp())
group by 1
),
busy as (
select
warehouse_name,
sum(total_elapsed_time) / 1000 / 3600 as query_hours
from snowflake.account_usage.query_history
where start_time > dateadd('day', -14, current_timestamp())
and warehouse_name is not null
group by 1
)
select
m.warehouse_name,
m.credits,
round(b.query_hours, 1) as query_hours,
round(m.credits / nullif(b.query_hours, 0), 2) as credits_per_query_hour
from metered m
left join busy b using (warehouse_name)
order by m.credits desc;
credits_per_query_hour well above the warehouse’s nominal credit
rate means you are paying for air. On one account this query found a
LOADING_WH billing 340 credits a month to run about nine hours of
actual work.
2. Find out where the money goes
Do not optimize a feeling. Snowflake bills three meters, and they are not close to equal. Warehouse compute is usually 80 to 90 percent of the invoice. Storage is often under 10 percent and close to irreducible. Serverless features (automatic clustering, Snowpipe, materialized view maintenance, search optimization) are the rest, and they grow quietly because nobody owns them. Prove that split for your own account:
-- Credit split by service for the last 30 days.
select
service_type,
sum(credits_used) as credits,
round(100 * ratio_to_report(sum(credits_used)) over (), 1) as pct_of_total
from snowflake.account_usage.metering_history
where start_time > dateadd('day', -30, current_timestamp())
group by 1
order by credits desc;
If WAREHOUSE_METERING is not the top line, your account is unusual
and the order of this list changes. Then look at 30-day credits by
warehouse:
select
warehouse_name,
sum(credits_used) as credits,
round(credits * 3.0, 0) as approx_usd -- your contract rate
from snowflake.account_usage.warehouse_metering_history
where start_time > dateadd(day, -30, current_timestamp())
group by 1
order by 2 desc;
Most expensive queries (last 7 days):
select
query_id,
warehouse_name,
total_elapsed_time / 1000 as seconds,
partitions_scanned,
partitions_total,
left(query_text, 180) as query_text
from snowflake.account_usage.query_history
where start_time > dateadd(day, -7, current_timestamp())
and execution_status = 'SUCCESS'
order by total_elapsed_time desc
limit 20;
partitions_scanned close to partitions_total is a full scan,
usually a missing filter, a function on the filter column, or a table
that needs clustering.
Multiply credits by your contract rate if you think in dollars.
ACCOUNT_USAGE lags. For “what is on fire right now” use
INFORMATION_SCHEMA query history in the account.
Idle vs scan is a different diagnosis. A warehouse that never suspends is an idle problem. A query that scans every micropartition is a SQL problem. Do not buy a larger warehouse for the first one.
flowchart TD
bill[Credit spike] --> idle{Warehouse rarely suspends?}
idle -->|yes| suspend[Auto-suspend + kill held sessions]
idle -->|no| scan{partitions_scanned ≈ partitions_total?}
scan -->|yes| sql[Fix filter / clustering / SELECT *]
scan -->|no| size[Right-size or split BI vs ELT]
Idle first, then scans, then size. Size last.
Who is holding the warehouse:
select
warehouse_name,
user_name,
count(*) as queries,
sum(total_elapsed_time) / 1000 as seconds
from snowflake.account_usage.query_history
where start_time > dateadd('day', -1, current_timestamp())
and execution_status = 'SUCCESS'
group by 1, 2
order by seconds desc
limit 20;
Group by query shape, not query_id
Cost is never evenly spread. The top ten query patterns typically
account for a quarter to a half of warehouse credits. Fixing ten
things is a week of work; fixing everything is a quarter you do not
have. Group by query_parameterized_hash, because the same dashboard
tile runs 4,000 times a day with different literals:
-- Top query patterns by warehouse hours, with the signals that pick the fix.
select
query_parameterized_hash,
any_value(left(query_text, 200)) as sample_text,
any_value(warehouse_name) as warehouse,
count(*) as executions,
round(sum(total_elapsed_time) / 1000 / 3600, 2) as warehouse_hours,
round(avg(partitions_scanned / nullif(partitions_total, 0)), 2) as avg_scan_ratio,
sum(bytes_spilled_to_local_storage) / power(1024, 3) as gb_spilled_local,
sum(bytes_spilled_to_remote_storage) / power(1024, 3) as gb_spilled_remote
from snowflake.account_usage.query_history
where start_time > dateadd('day', -14, current_timestamp())
and execution_status = 'SUCCESS'
and warehouse_size is not null
group by 1
order by warehouse_hours desc
limit 20;
A high avg_scan_ratio on a large table is a pruning problem: read
micro-partitions and pruning
and check whether someone wrapped a timestamp column in TO_DATE.
Remote spill means the warehouse is too small for the working set. A
pattern with 40,000 executions and a two-second runtime is a caching
or scheduling problem, not a SQL problem.
flowchart TD
top["Top 10 query patterns by warehouse hours"] --> q{"What does the profile say?"}
q -->|"scan ratio near 1.0"| prune["Fix predicate or clustering"]
q -->|"remote spill"| size["Size up one step"]
q -->|"huge execution count"| sched["Cache, materialize, or slow the schedule"]
q -->|"none of the above"| rewrite["Rewrite the SQL"]
prune --> measure["Re-measure in 7 days"]
size --> measure
sched --> measure
rewrite --> measure
Four buckets, four fixes. The re-measure step is what keeps the work honest.
3. Right-size warehouses (start small)
Each size doubles credits per hour. A Large that finishes in 10 minutes costs the same as a Medium that finishes in 20, if the job scales.
If Medium finishes in 12 minutes, you just saved ~40%.
Test one size down on a representative run. Use the mental model that size doubles credits per hour: linear vs “does not scale” cases. Tiny SQL and single-file copies do not scale; big scans and transforms often do. Neither does a single-threaded UDF or a query bottlenecked on a remote fetch. Size those up and you pay double for the same duration.
alter warehouse transforming set warehouse_size = 'SMALL';
Multi-cluster is for concurrency, not a substitute for a bigger size. If one query is slow, add size or fix the SQL. If 40 dashboards queue, add clusters.
Spill and queue time tell you which direction to go:
-- Spill and queue signals: up versus out.
select
warehouse_name,
count(*) as queries,
sum(iff(bytes_spilled_to_remote_storage > 0, 1, 0)) as remote_spill_queries,
round(avg(queued_overload_time) / 1000, 2) as avg_queue_seconds,
round(max(queued_overload_time) / 1000, 2) as max_queue_seconds
from snowflake.account_usage.query_history
where start_time > dateadd('day', -7, current_timestamp())
and warehouse_name is not null
group by 1
having remote_spill_queries > 0 or avg_queue_seconds > 1
order by remote_spill_queries desc;
Remote spill on a meaningful share of queries: go up one size and re-measure. Queueing with no spill: add clusters, not size. Both: split the workload, because batch transforms and interactive queries are fighting over one warehouse. The signal-by-signal version is in the warehouse sizing guide.
4. Separate workloads
One warehouse per workload type:
| Warehouse | Work |
|---|---|
loading |
COPY, Snowpipe-adjacent bursts |
transforming |
dbt / Tasks |
bi |
Tableau / Looker / Hex |
A Monday backfill should not force a Large on the CFO’s dashboard. Split warehouses also make the metering view readable.
You cannot optimize what you cannot attribute. One warehouse serving
dbt, BI, ad hoc analysts and a reverse-ETL tool is a single number
nobody owns. Four warehouses is four numbers with four owners, and
owners optimize. Give each one an AUTO_SUSPEND of 60 and a resource
monitor, then use query tags (below) to slice further without creating
more warehouses.
5. Cluster only your biggest tables
Clustering keys help pruning on multi-terabyte tables that are always filtered the same way (usually a date).
alter table analytics.gold.events
cluster by (event_date);
Do not cluster a 20 GB dimension. Automatic clustering is a background
credit spend. If automatic_clustering_history costs more than the
queries you saved, drop the key.
select
table_name,
sum(credits_used) as clustering_credits
from snowflake.account_usage.automatic_clustering_history
where start_time > dateadd(day, -30, current_timestamp())
group by 1
order by 2 desc;
Automatic clustering bills forever and often outlives the query pattern that justified it. Any key on that list without a named owner and a measured benefit gets suspended. The clustering keys guide has the full argument for when a key earns its rent.
Search Optimization Service is the other paid accelerator for point lookups (SKU, email), not analytics scans. Enable it for that use case only.
6. Kill zombie schedules
Hourly dashboards nobody opened this quarter are a warehouse that never
sleeps. Cross-reference query_history with BI usage. Disable the
schedule or raise the grain to daily.
This is the bucket teams skip, and it is often the cheapest. A dbt job
that runs hourly because someone typed 0 * * * * in 2023, feeding a
report nobody opens before 9 a.m., is 23 wasted runs a day. Reading
cron expressions has cut more credits than tuning SQL.
The same applies to Tasks that still run after the product died.
7. Set resource monitors
The circuit breaker:
create resource monitor monthly_cap
with credit_quota = 500
frequency = monthly
start_timestamp = immediately
triggers
on 75 percent do notify
on 100 percent do suspend;
Attach it to the warehouses that can surprise you (dev, ad-hoc, a new vendor tool). Notify at 75% so you have time to act. Suspend at 100% on non-prod first; prod suspends need a page-ready owner.
Every warehouse should have a monitor, and most should never fire. The point is the notification: you want to hear about a runaway backfill at 60 percent of budget, not discover it on the invoice. A tiered version, attached to one warehouse:
create or replace resource monitor rm_transforming
with credit_quota = 400
frequency = monthly
start_timestamp = immediately
triggers
on 60 percent do notify -- early warning
on 85 percent do notify -- someone should be looking
on 100 percent do suspend -- let running queries finish
on 110 percent do suspend_immediate;
alter warehouse transforming set resource_monitor = rm_transforming;
Two things people get wrong. Notifications only reach users who have a verified email and notifications enabled in their Snowsight preferences, so test with a throwaway quota. And an account-level monitor that suspends everything is a production incident waiting to happen. Use warehouse-level monitors for enforcement and an account-level one for notify-only visibility.
Monitors do not cap Cortex tokens or storage. Those are separate bills. See the Cortex guide.
Query tags and a hard timeout
A warehouse shared by dbt and a BI tool is a mystery until every job sets a tag. Then Monday’s credit spike has a name.
alter session set query_tag = 'dbt:fct_orders:prod';
alter warehouse transforming set statement_timeout_in_seconds = 1800;
Thirty minutes is plenty for a well-partitioned incremental. A runaway Cartesian product should die, not finish the month’s credits. Put the timeout on the warehouse, not only in a worksheet you close.
A JSON tag lets you attribute spend to teams without another warehouse. Have the orchestrator set it at session start (dbt can do this via query-comment):
alter session set query_tag = '{"job":"dbt_hourly","env":"prod","team":"growth"}';
select
try_parse_json(query_tag):team::string as team,
round(sum(total_elapsed_time) / 1000 / 3600, 1) as warehouse_hours
from snowflake.account_usage.query_history
where start_time > dateadd('day', -30, current_timestamp())
and query_tag like '{%'
group by 1
order by warehouse_hours desc;
Chargeback does not have to be real money. Publishing the table is usually enough. The month a team-by-team credit report went out, the growth team found and deleted a Looker schedule that cost more than their tooling budget, without anyone asking.
flowchart LR
dbt[dbt models] --> t[transforming]
bi[Dashboards] --> b[bi]
copy[COPY / Snowpipe] --> l[loading]
t --> meter[ACCOUNT_USAGE]
b --> meter
l --> meter
One warehouse per job type. Metering is readable only after you split.
Result cache is not a strategy
Snowflake can return a cached result when the SQL text and the underlying data have not changed. That is a gift for a repeated worksheet. It is not a warehouse-sizing plan.
Do not “optimize” a dashboard by hoping the cache hits. If the underlying table ticks every five minutes, the cache will miss and you will pay the warehouse again. Materialize the grain. Then the dashboard is cheap for a different reason.
When the cache does hit, it costs no warehouse time at all, so do not
defeat it by accident. Sprinkling CURRENT_TIMESTAMP() into dashboard
SQL makes every run a miss.
RESULT_SCAN(last_query_id()) is for chaining worksheets, not for
production jobs.
COPY and Snowpipe are not “free compute”
COPY INTO still wakes a warehouse. Snowpipe has its own credit
meter. A landing job that lists a million tiny files will spend
more on listing than on bytes.
select
pipe_name,
sum(credits_used) as pipe_credits
from snowflake.account_usage.pipe_usage_history
where start_time > dateadd(day, -30, current_timestamp())
group by 1
order by 2 desc;
If the pipe is expensive, fix file size (aim for a few hundred MB compressed) before you buy a larger loading warehouse.
Time Travel and storage
Compute is the noisy line item. Storage from long Time Travel on bronze is the quiet one. Set retention in the table PR. Details in Time Travel.
Retention multiplies the storage of high-churn tables, because every rewritten micro-partition is kept for the retention window plus seven days of fail-safe. A 90-day retention on a table that is fully rewritten nightly is a very expensive setting. The rule: 1 day for staging and dev, 7 for most production tables, longer only where a compliance requirement names a number.
The habit that matters
Fifteen minutes every Monday: top warehouses, top queries, any warehouse
that did not suspend. Put the two ACCOUNT_USAGE queries in a saved
worksheet. Cost work that is only a Q4 project always returns.
Better still, build the looking into the pipeline. Materialize the
ACCOUNT_USAGE queries above into a small cost mart, run it daily, and
alert on week-over-week deltas rather than absolute thresholds. Your
dbt project is a
perfectly good home for it; it is just another set of models. Put the
top-ten offender list somewhere people read. Cost work that is not on
a recurring schedule decays within two quarters.
What I watch after a change
- Credits per warehouse vs last week (same weekday)
- Share of queries with
partitions_scanned = partitions_total - Warehouses with zero auto-suspend events
- Time Travel bytes on bronze (see Time Travel)
If credits dropped and dashboards got slower, you sized down a job that does not scale. Put it back one size and fix the SQL.
Pitfalls
Shrinking warehouses as the first move. It is the most visible lever and the least effective. Shrink the biggest warehouse first and a typical result is a four percent drop, three slower dashboards and two analyst tickets by Thursday. Idle time and bad scans come first.
Setting auto-suspend to 600 and forgetting it. It is the default
and wrong for nearly every warehouse. Audit ACCOUNT_USAGE.WAREHOUSES
quarterly, because new warehouses keep appearing with it.
Resource monitors that only suspend. By the time the suspension fires you have spent the money and now you have an outage too. Notify early, suspend late.
Optimizing a query that runs twice a month. Sort by total warehouse hours, not worst single runtime. The 40-minute monthly report is not your problem; the 8-second query running 30,000 times a day is.
Declaring victory from one week of data. Month-end close, quarterly backfills and Black Friday all distort. Compare 28-day windows against the previous 28 days, and keep the report running so the savings do not silently regress.
FAQ
How much can I realistically save? On an account nobody has tuned, 25 to 40 percent within a month is normal, and roughly half of that comes from auto-suspend and scheduling changes alone. On an account that has been through this once, expect 5 to 10 percent a year of ongoing drift management. If someone promises 60 percent without touching workload, they have not seen your queries.
Should I use a smaller warehouse or a shorter query? A shorter query, every time. Size changes shift cost between two axes that often cancel out; removing scanned bytes reduces the work itself. Fix the predicate, then decide the size.
Do multi-cluster warehouses cost more?
Only when extra clusters are actually running. The ECONOMY scaling
policy is conservative about spinning clusters up, saving credits at
the cost of some queueing; STANDARD favors latency. Use STANDARD
for BI and ECONOMY for batch.
Does a bigger warehouse always cost more? Per hour, yes: each size doubles. Per query, no: a Large that finishes in half the time of a Medium can break even. Test a representative run.
Will auto-suspend at 60 seconds hurt BI? It can, because you lose the warehouse cache. Keep 5 to 10 minutes on the BI warehouse; use 60 seconds on ELT.
Do resource monitors cap Cortex and storage? No. They cap warehouse credits on the objects you attach. Token and storage bills are separate.
Should I cluster every large table?
No. Cluster tables that are filtered the same way and large enough
that pruning pays for automatic clustering. Check
automatic_clustering_history.
Is SELECT * a cost bug? On columnar storage, yes: you pay to scan columns nobody needs. Name the columns on hot queries.
What this means for your pipelines
Cost work is a weekly habit: metering, top queries, then one knob. Do not wait for finance to forward the invoice.
It is an attribution project, not an austerity project. Nearly every dollar of waste is invisible until someone makes it visible: a warehouse with no owner, a schedule nobody re-read, a clustering key from a migration two years ago, a dashboard hitting a table with a wrapped date filter. Tag every session with job, team and environment, and give every warehouse a monitor and a name that says what it is for. When the free wins are gone, you make the trade-offs with numbers in hand, and you can tell an analyst exactly what their dashboard costs before you change it.
Senior Data & AI Engineer · SnowPro Core & Gen AI Certified
4+ years building production data platforms on Snowflake, Databricks, AWS, and Azure. I write from hands-on experience with Medallion architectures, dbt, Airflow, PySpark, and Snowflake Cortex AI. Every tutorial on this blog reflects real pipeline decisions, not documentation rewrites.
Read more about the author →