To cut Snowflake costs without slowing your pipelines, measure each pipeline first, then change one thing at a time. Start with changes that remove work or idle time, because they rarely touch run time. Shrink compute last, and watch the signal that shows it went too far: overload queuing for too little concurrency, heavy or local spilling for too little memory. Then compare equal windows. Every fact and figure in this guide was checked against Snowflake’s documentation.
This article is part of our guide to Snowflake cost optimization.
What is the safest way to cut Snowflake costs without slowing pipelines?
Treat every change as an experiment with a guardrail. First, record each pipeline’s run time, queue time, spilling and credits. Next, apply the change. Then compare the same numbers over an equal window. If credits fell but the slow tail grew, the saving came out of your delivery time, so revert it.
How do you measure a pipeline’s baseline before changing anything?
Pull four numbers for each pipeline: run time, queue time, bytes spilled and credits. Snowflake records task timing in TASK_HISTORY, query timing and spilling in QUERY_HISTORY, and credits in WAREHOUSE_METERING_HISTORY and QUERY_ATTRIBUTION_HISTORY. Keep the slow tail, such as the 95th percentile, not just the average.
Task run time, queue time and credits per run
Snowflake’s introduction to tasks defines queue time as QUERY_START_TIME minus SCHEDULED_TIME in TASK_HISTORY, and run time as COMPLETED_TIME minus QUERY_START_TIME. The same page warns that longer queues are common when tasks run on a shared or busy warehouse.
The query below adds credits per run from QUERY_ATTRIBUTION_HISTORY. It rolls each child statement up to its root, so a task that calls a stored procedure still gets one total. However, that view excludes warehouse idle time and queries of about 100 ms or less. It covers tasks that run on a warehouse, not serverless tasks or Adaptive Warehouses. A SKIPPED run means the WHEN condition returned FALSE.
-- Role: USAGE_VIEWER database role (or ACCOUNTADMIN).
-- Returns runs by state, average queue seconds, 95th percentile run seconds and attributed credits per run (warehouse plus Query Acceleration), per task, for runs scheduled in the last 14 days that finished at least 8 hours ago. Latency up to 8 hours. Runs with no attribution row (about 100 ms or less, Adaptive Warehouses) count as zero credits and are shown separately.
WITH run_credits AS (
SELECT COALESCE(root_query_id, query_id) AS run_query_id,
SUM(credits_attributed_compute + COALESCE(credits_used_query_acceleration, 0)) AS credits
FROM snowflake.account_usage.query_attribution_history
WHERE start_time >= DATEADD(day, -14, CURRENT_TIMESTAMP())
GROUP BY 1
)
SELECT th.database_name, th.schema_name, th.name AS task_name,
COUNT_IF(th.state = 'SUCCEEDED') AS succeeded_runs,
COUNT_IF(th.state = 'SKIPPED') AS skipped_runs, -- WHEN condition returned FALSE
COUNT_IF(th.state LIKE 'FAILED%') AS failed_runs,
AVG(IFF(th.state = 'SUCCEEDED',
DATEDIFF('second', th.scheduled_time, th.query_start_time), NULL)) AS avg_queue_s,
APPROX_PERCENTILE(IFF(th.state = 'SUCCEEDED',
DATEDIFF('second', th.query_start_time, th.completed_time), NULL), 0.95) AS p95_run_s,
SUM(IFF(th.state = 'SUCCEEDED', rc.credits, NULL))
/ NULLIF(COUNT_IF(th.state = 'SUCCEEDED'), 0) AS credits_per_run,
COUNT_IF(th.state = 'SUCCEEDED' AND rc.credits IS NULL) AS runs_without_credits
FROM snowflake.account_usage.task_history th
LEFT JOIN run_credits rc ON rc.run_query_id = th.query_id
WHERE th.scheduled_time >= DATEADD(day, -14, CURRENT_TIMESTAMP())
AND COALESCE(th.completed_time, th.scheduled_time)
< DATEADD(hour, -8, CURRENT_TIMESTAMP()) -- attribution for these runs has landed
GROUP BY 1, 2, 3
ORDER BY p95_run_s DESC NULLS LAST;
Queuing and spilling on the pipeline’s warehouse
QUERY_HISTORY splits waiting into causes. QUEUED_OVERLOAD_TIME is time queued because the warehouse was overloaded. QUEUED_PROVISIONING_TIME is time spent waiting while the warehouse is created, resumed or resized. BYTES_SPILLED_TO_LOCAL_STORAGE and BYTES_SPILLED_TO_REMOTE_STORAGE show memory pressure. All times are in milliseconds.
-- Role: GOVERNANCE_VIEWER database role (or ACCOUNTADMIN).
-- Returns daily query count, 95th percentile elapsed seconds, queue seconds by cause and spilled GiB for one warehouse, last 14 days. Latency up to 45 minutes.
SELECT DATE_TRUNC('day', start_time) AS day,
COUNT(*) AS queries,
APPROX_PERCENTILE(total_elapsed_time, 0.95) / 1000 AS p95_elapsed_s,
SUM(queued_overload_time) / 1000 AS overload_queue_s,
SUM(queued_provisioning_time) / 1000 AS provisioning_queue_s,
SUM(bytes_spilled_to_local_storage) / POWER(1024, 3) AS local_spill_gib,
SUM(bytes_spilled_to_remote_storage) / POWER(1024, 3) AS remote_spill_gib
FROM snowflake.account_usage.query_history
WHERE warehouse_name = 'PIPELINE_WH'
AND start_time >= DATEADD(day, -14, CURRENT_TIMESTAMP())
GROUP BY 1
ORDER BY 1;
Warehouse credits, including idle time
Attribution leaves idle time out, so an auto-suspend saving does not show up there. WAREHOUSE_METERING_HISTORY shows it. CREDITS_USED_COMPUTE minus CREDITS_ATTRIBUTED_COMPUTE_QUERIES is idle time.
-- Role: USAGE_VIEWER database role (or ACCOUNTADMIN).
-- Returns daily compute credits and idle credits for one warehouse, last 14 days. Latency up to 3 hours. Idle credits are NULL on Adaptive Warehouses.
SELECT DATE_TRUNC('day', start_time) AS day,
SUM(credits_used_compute) AS compute_credits,
SUM(credits_used_compute) - SUM(credits_attributed_compute_queries) AS idle_credits
FROM snowflake.account_usage.warehouse_metering_history
WHERE warehouse_name = 'PIPELINE_WH'
AND start_time >= DATEADD(day, -14, CURRENT_TIMESTAMP())
GROUP BY 1
ORDER BY 1;
Snowflake’s Account Usage page lists the database role for each view.
Which changes cut credits without slowing the pipeline, and which can?
The first four rows remove work or idle time, so they carry little latency risk. The fifth stops broken work, but a suspended task delivers nothing until someone resumes it. The last three shrink compute, so each one can slow a run if the warehouse runs short of memory or capacity. Make one change at a time.
| Change | Cuts credits by | Latency risk | Signal to watch |
|---|---|---|---|
| Skip runs with no new data | No compute on empty runs | None | Skipped vs succeeded runs |
| Incremental models | Less data per run | Low | Run time and credits per run |
| Separate pipelines from other work | Sizing each warehouse to its work | Low | Task queue time, idle credits |
| Auto-suspend matched to the schedule | Less idle time | Low on task warehouses | Provisioning queue time |
| Suspend repeatedly failing tasks | No reruns of broken work | Medium: a suspended task or graph delivers nothing | Failed runs, suspended tasks |
| Downsize one step | Half the credits per hour | Medium | Spilling, p95 run time, overload queue, QAS credits |
| Fewer clusters or Economy policy | Fewer extra clusters | Medium | Overload queue time |
| Turn off Query Acceleration | No QAS credits | Medium for outlier queries | Elapsed time of accelerated queries |
Remove work first
A stream records the rows that changed in a table. A triggered or scheduled task with WHEN SYSTEM$STREAM_HAS_DATA skips its run when that check returns FALSE. The check is not guaranteed to return FALSE for an empty stream, so some empty runs may still execute. When the check returns TRUE, the task must consume the stream in a DML statement, even if it finds no rows. Otherwise the check keeps returning TRUE and the task never skips. According to CREATE TASK, the check needs no warehouse compute, only a nominal cloud services charge. So align the schedule with how often data arrives.
Next, stop rebuilding what has not changed. In dbt, that means incremental models, covered in our guide to the Snowflake cost of dbt models. Also set SUSPEND_TASK_AFTER_NUM_FAILURES on the standalone or root task, which Snowflake says can cut credits spent on tasks that fail to complete. Timeouts count as failures, and in a task graph one failing task suspends the whole graph, so alert on suspended tasks.
-- Role: the role that owns the task (OWNERSHIP). Only the owner can set task properties.
-- RESUME also needs the global EXECUTE TASK privilege and USAGE on the task's warehouse.
-- Returns status messages. A started standalone task must be suspended before you change it;
-- for a task in a graph, suspend the root task instead. The task body must consume orders_stream
-- in a DML statement, or the WHEN check keeps returning TRUE. RESUME resets the base time of an
-- interval schedule. Timeouts count toward SUSPEND_TASK_AFTER_NUM_FAILURES.
ALTER TASK load_orders SUSPEND;
ALTER TASK load_orders MODIFY WHEN SYSTEM$STREAM_HAS_DATA('orders_stream');
ALTER TASK load_orders SET SUSPEND_TASK_AFTER_NUM_FAILURES = 3;
ALTER TASK load_orders RESUME;
Separate workloads, then match auto-suspend to the schedule
Snowflake’s warehouse considerations advise running similar queries on the same warehouse, because mixed workloads make sizing harder. Therefore, give a pipeline its own warehouse when its size or timing needs differ. However, more warehouses mean more idle time and 60-second minimums, so keep consolidating small jobs that share a size and schedule.
For task warehouses, Snowflake’s warehouse cache guidance recommends immediate suspension. CREATE WAREHOUSE defaults AUTO_SUSPEND to 600 seconds. Suspending drops the warehouse cache, and every resume bills at least 60 seconds. So Snowflake advises against a 1 or 2 minute setting when queries arrive every 2 or 3 minutes. Watch QUEUED_PROVISIONING_TIME after the change. For the full trade-off, see Snowflake auto-suspend.
-- Role: a role with MODIFY on the warehouse (or its owner).
-- Returns a status message. Suspends the task warehouse after about 60 seconds idle; the check runs about every 30 seconds.
ALTER WAREHOUSE pipeline_wh SET AUTO_SUSPEND = 60;
Shrink compute last, and read the signal
Heavy spilling means too little memory. Snowflake’s memory guidance says performance degrades sharply when a query spills to local disk, and more when it spills to remote storage. Its fixes are a larger warehouse or smaller batches. One catch: with Query Acceleration on, Snowflake writes a little to remote storage for each eligible query. Query Acceleration needs Enterprise Edition or higher. Since BCR-2373, it is on by default for every new standard warehouse, Gen1 or Gen2. Therefore, check local spill first and compare volumes, not just “greater than zero”. Query Acceleration bills its own credits, which the attribution query includes. Turning it off removes them, but accelerated queries then run on the warehouse alone, so first note the elapsed time of queries with QUERY_ACCELERATION_BYTES_SCANNED above zero.
Overload queuing means too little concurrency. Snowflake’s page on reducing queues suggests moving queries to other warehouses, converting to a multi-cluster warehouse (Enterprise Edition or higher), or raising the maximum cluster count. The Economy policy keeps running clusters fully loaded, which may queue queries. So if QUEUED_OVERLOAD_TIME climbs after you cut clusters, move work or add a cluster back. A bigger size is not Snowflake’s intended fix for that case: its warehouse considerations say resizing is not intended for concurrency issues. However, if queuing follows a downsize, slower runs are overlapping, so revert the size. See our guide to multi-cluster warehouses.
Is a smaller warehouse always cheaper?
No. Each size down halves the credits per hour, so a run must take less than twice as long to save anything. Take an illustrative nightly job on a Gen2 standard warehouse on AWS. Large uses 10.8 credits per hour and Medium uses 5.4, per Table 1(b) of Snowflake’s Service Consumption Table.
- On Large, the job runs 40 minutes and uses 7.2 credits.
- On Medium, if it runs 70 minutes, it uses 6.3 credits. That saves 0.9 credits per run, but the job finishes 30 minutes later.
- If it spills on Medium and runs 90 minutes, it uses 8.1 credits. That costs 0.9 credits more, and the job finishes 50 minutes later.
Medium breaks even at 80 minutes. Snowflake advises testing the same queries on more than one size. For credits per hour at every size, see Snowflake warehouse sizes and credits per hour.
How do you prove a change did not slow the pipeline?
Rerun the baseline queries over a window of the same length after the change. Wait out the view latency first: up to 45 minutes for query and task history, 3 hours for metering and 8 hours for attribution. Then compare credits per run and the 95th percentile run time side by side. Keep the change only if both hold.
Use this checklist for each change:
- Credits per run fell. Use metering for idle-time changes and attribution for per-task changes.
- The p95 run time held. It must stay inside your delivery deadline.
- Task queue time held. A rise means runs waited longer to start. Check QUEUED_OVERLOAD_TIME and QUEUED_PROVISIONING_TIME for the same runs to see whether the warehouse was busy or resuming.
- Spilling did not grow. Local spill is the early warning. With Query Acceleration on, a small remote spill on eligible queries is expected, so compare volumes.
- The run still fits its interval. If a standalone scheduled task is still running at its next scheduled time, Snowflake skips that run. Keep the p95 run time below the schedule interval.
If any check fails, revert first and investigate second.
How Seemore helps with pipeline cost and speed
Seemore’s Cost Anomaly Detection compares each day’s spend for the accounts and warehouses its rules cover against the previous 14 days and explains the likely root cause of each spike or drop. Real Time Monitoring shows what is running and queued on every warehouse across your connected accounts, and can list the queries behind the load, and the Seemore platform attributes cost by user, domain and query tag, so you can see which tool or pipeline ran each query. You can also ask Seemore Assistant about your environment in plain language instead of writing the SQL above.
Frequently asked questions
How do you cut Snowflake costs without slowing pipelines?
Measure each pipeline’s run time, queue time, spilling and credits first. Then remove work and idle time, such as skipping runs with no new data and matching auto-suspend to the schedule. Shrink warehouses or clusters last, one step at a time, and compare the same numbers afterward.
What should you measure before trying to cut Snowflake costs without slowing pipelines?
Record the 95th percentile run time, task queue time, QUEUED_OVERLOAD_TIME, bytes spilled to local and remote storage, and credits per run. Use the same window length before and after the change.
Do Snowflake tasks use credits when a stream has no new data?
A task with WHEN SYSTEM$STREAM_HAS_DATA skips the run when the check returns FALSE. The check runs in cloud services, not on the warehouse, and cloud services are billed only above 10% of daily compute usage. The check can still return TRUE for an empty stream, and the task must consume the stream, or it never skips.
Does spilling to remote storage always mean a Snowflake warehouse is too small?
Not always. With Query Acceleration enabled, Snowflake writes a small amount to remote storage for each eligible query, even when acceleration is not used. Check local spill and volumes, and confirm run time grew, before you size up.
What does QUEUED_OVERLOAD_TIME mean in Snowflake?
It is the time in milliseconds a query waited in the warehouse queue because the current workload overloaded the warehouse. A rise after you cut clusters or merge workloads means the warehouse lacks concurrency. Snowflake suggests more warehouses, a multi-cluster warehouse or a higher maximum cluster count.
How do you measure Snowflake task run time and queue time?
Query the TASK_HISTORY view in ACCOUNT_USAGE. Queue time is QUERY_START_TIME minus SCHEDULED_TIME, and run time is COMPLETED_TIME minus QUERY_START_TIME. The view is readable with the USAGE_VIEWER database role or ACCOUNTADMIN, has up to 45 minutes of latency and keeps one year of history.