skip to content

Cost & Performance Tuning

Where the credits actually go, and the caching layers — result cache and warehouse cache — that make a repeated query nearly free. Interviewers ask me to read a Query Profile and name the fix, because 'use a bigger warehouse' is the wrong first answer.

part ofSnowflakeoverview, primer and where to startread it →
on this pageshow

questions

7

In Snowflake, what actually consumes credits, and what is billed outside the credit meter?

level: juniorimportance: must knowfreq 72%

answer

  1. credits measure compute, not stored bytes
  2. the meter runs on wall-clock, not rows
  3. starting compute has a minimum charge
  4. some features bill with no warehouse at all
  5. storage bills per TB-month outside credits

basics

~20 s

Credits meter compute: a virtual warehouse burns them per second while it is running, serverless features burn them with no warehouse, and cloud services burn them above a daily allowance. Storage and data egress are billed separately, not in credits.

solid answer

~50 s

Snowflake meters **compute** in credits. A virtual warehouse consumes credits per second for every second it is in the running state — whether or not a query is executing — with a 60-second minimum charge each time it starts or resumes, and the per-second rate rises with warehouse size. **Serverless** features (Snowpipe, automatic clustering, materialized-view maintenance, search optimization maintenance, replication) consume credits on Snowflake-managed compute with no warehouse involved, so the bill can grow while every warehouse is suspended. The **cloud services** layer also consumes credits, but is only charged to the extent a day's cloud-services usage exceeds 10% of that day's warehouse credits. **Storage** is billed separately per TB-month on average daily compressed bytes (including Time Travel and Fail-safe), and cross-region/cross-cloud data transfer is billed separately again. So cost is warehouse-seconds, not bytes scanned.

code

sql · 8 lines
sql
-- Credits by warehouse over the last 30 days
SELECT warehouse_name,
       SUM(credits_used_compute)       AS compute_credits,
       SUM(credits_used_cloud_services) AS cloud_services_credits
FROM snowflake.account_usage.warehouse_metering_history
WHERE start_time >= DATEADD(day, -30, CURRENT_TIMESTAMP())
GROUP BY 1
ORDER BY compute_credits DESC;

go deeper

for a junior

Be ready to name the three buckets without hesitation: compute in credits, storage per TB-month, data egress separately. Knowing that the warehouse meter runs on time rather than on rows is the point being tested.

for a middle

Explain the mechanics: per-second billing with a 60-second minimum on resume, credit rate scaling with size, the 10% daily cloud-services adjustment, and serverless features that bill without any warehouse.

for a senior

Show you can attribute spend: which ACCOUNT_USAGE views answer which question, why the views lag real time, and how Time Travel and Fail-safe inflate storage well beyond live table bytes.

for a principal

Own the framing that Snowflake cost is warehouse-seconds. Be able to argue which lever moves the bill most for a given workload mix, and how you would make each team's consumption visible before you try to cap it.

## What a credit is A credit is Snowflake's unit of compute consumption. It is not a currency: the dollar value of a credit depends on edition, cloud provider and region, and it changes over time — quoting a rate from memory in an interview is a mistake. What you are expected to know is *which activities burn credits* and *what the meter is measuring*. ## Virtual warehouse compute — the dominant line item A virtual warehouse is a cluster of compute nodes Snowflake starts on your behalf. While that cluster is in the `running` state it consumes credits **per second**, whether it is executing a query or sitting idle with an open session. Each time a warehouse starts or resumes there is a **60-second minimum** charge, so a warehouse that resumes for a two-second query still bills a full minute. The per-hour credit rate scales with warehouse size, and a multi-cluster warehouse bills each running cluster. The crucial consequence: **the meter is time-based, not data-based**. Halving the bytes a query scans saves money only if it shortens the seconds the warehouse spends running or lets it suspend sooner. This is the opposite of BigQuery's on-demand model, where the bill is literally bytes processed, and interviewers probe the difference deliberately. ## Cloud services The cloud services layer — optimizer, metadata store, authentication, access control, the result cache — runs on Snowflake-managed compute and consumes credits too. Snowflake applies a daily adjustment: cloud-services credits are billed only to the extent that a day's cloud-services consumption exceeds **10%** of that day's virtual-warehouse credits. Most workloads never pay for it. The ones that do are metadata-heavy and compute-light: floods of `SHOW` commands and `INFORMATION_SCHEMA` queries, huge numbers of tiny single-row DML statements, or heavy use of result-cache-only reads with almost no warehouse activity to earn the allowance. ## Serverless features Several features run on Snowflake-managed compute rather than on your warehouse, and each has its own credit rate: Snowpipe and Snowpipe Streaming, automatic clustering, materialized-view maintenance, search-optimization maintenance, replication, and tasks configured to run serverless. These bill independently of any warehouse, which is why a bill can rise on a weekend when nobody is querying. They are also the credits that resource monitors do **not** stop, so they need their own monitoring. ## Storage and data transfer Storage is billed monthly on **average daily compressed bytes**, at a per-TB rate, outside the credit meter. It covers table data plus Time Travel versions, Fail-safe copies, clones' unique bytes, and files sitting in internal stages — which is why a table that looks small can bill much larger after heavy churn with a long `DATA_RETENTION_TIME_IN_DAYS`. Data transfer (egress to another region or cloud) is billed separately again. On a typical account, storage is a small fraction of spend and compute dominates. ## Seeing where the credits went The `SNOWFLAKE.ACCOUNT_USAGE` schema is where you answer "who spent it": ```sql SELECT warehouse_name, SUM(credits_used) AS credits FROM snowflake.account_usage.warehouse_metering_history WHERE start_time >= DATEADD(day, -30, CURRENT_TIMESTAMP()) GROUP BY 1 ORDER BY credits DESC; ``` `WAREHOUSE_METERING_HISTORY` gives credits per warehouse per hour; `METERING_DAILY_HISTORY` breaks the whole account down by credit type including serverless; `QUERY_HISTORY` tells you which statements ran on which warehouse; `TABLE_STORAGE_METRICS` and `STORAGE_USAGE` cover bytes. Recent Snowflake versions add `QUERY_ATTRIBUTION_HISTORY` for per-query credit attribution, which is the closest thing to a per-query price tag. All of these views lag real time by a latency window, so same-hour reconciliation is not possible from them — `INFORMATION_SCHEMA` table functions are the low-latency alternative. ## The tuning implication Because cost is credit-rate × seconds-running, the levers are: keep warehouses from idling, keep queries short, and let cheap layers (result cache, metadata-only answers) serve work without starting compute at all. "Scan fewer bytes" is a means to that end, not the billing unit itself.

  • If a query is answered entirely from the result cache, what does it cost?
    No virtual-warehouse credits at all — Snowflake serves it from the cloud services layer and does not even resume a suspended warehouse. The work does count toward cloud-services consumption, which is normally absorbed by the 10% daily adjustment. It is the cheapest possible outcome for a repeated dashboard query.
  • Why can a Snowflake bill grow in a week when every warehouse stayed suspended?
    Serverless features keep billing: Snowpipe ingesting files, automatic clustering reorganising micro-partitions, materialized-view and search-optimization maintenance, replication. Storage also accrues — heavy DML with a long Time Travel retention multiplies stored bytes through versions and Fail-safe. Check METERING_DAILY_HISTORY by service type and TABLE_STORAGE_METRICS.
  • How do you tell whether cloud-services credits are actually costing you money?
    Compare daily cloud-services credits against 10% of that day's warehouse credits in METERING_DAILY_HISTORY or WAREHOUSE_METERING_HISTORY; only the excess is billed. A persistent excess points at a metadata-heavy pattern — mass SHOW/INFORMATION_SCHEMA polling, very high-frequency single-row DML, or many tiny queries — rather than at query compute.

A running warehouse is a taxi with the meter on: you pay for the time the engine idles at the kerb, not for how many kilometres of data you asked it to carry.

saying these in an interview costs you the question

  • Says Snowflake bills per byte scanned like BigQuery on-demand
  • Claims storage is included in the compute credits
  • Thinks a running but idle warehouse costs nothing
  • Ignores serverless credits that bill with no warehouse running
  • Quotes a fixed dollar-per-credit rate as universal

context

open as a page

How do Snowflake's query result cache and a virtual warehouse's local disk cache differ?

level: middleimportance: must knowfreq 75%

basics

~20 s

The query result cache stores finished result sets in the cloud services layer and serves repeats without starting any warehouse, so it costs no warehouse credits. A warehouse's local disk cache holds column data on its own SSDs, still costs full warehouse time, and vanishes when that warehouse suspends.

open as a page

In Snowflake's Query Profile, which statistics tell you why a query is slow, and what fix does each imply?

level: seniorimportance: must knowfreq 66%

basics

~20 s

Read partitions scanned versus total for pruning, bytes spilled to local and remote storage for memory pressure, percentage scanned from cache for I/O locality, and the operator tree's row counts for exploding joins. Each points at a different fix: filter shape, query shape, cache warmth, join keys.

open as a page

In Snowflake, what does a resource monitor do when its credit quota is reached?

level: middleimportance: should knowfreq 48%

basics

~20 s

A resource monitor tracks credits used against a quota per interval and fires the triggers you defined: NOTIFY sends an alert, SUSPEND stops assigned warehouses after running queries finish, SUSPEND_IMMEDIATE kills them outright. Suspended warehouses resume when the next interval starts or the quota is raised.

open as a page

When is a Snowflake materialized view worth its maintenance cost, and what can it not contain?

level: seniorimportance: should knowfreq 44%

basics

~20 s

A Snowflake materialized view pays off when an expensive projection or aggregate over one slowly-changing table is queried far more often than the base table changes. It cannot join tables, use window functions, or read another view, and Snowflake maintains it with serverless credits proportional to base-table churn.

open as a page

An identical Snowflake query reruns hourly yet never reuses the result cache — what would you check?

level: seniorimportance: should knowfreq 55%

basics

~20 s

Check for execution-time functions like CURRENT_TIMESTAMP, any DML or background rewrite on the referenced tables, query text that is not byte-identical because a tool injects comments or literals, USE_CACHED_RESULT set to FALSE, and a role lacking privileges on every referenced table.

open as a page

What does Snowflake's search optimization service speed up, and when is it the wrong tool?

level: seniorimportance: nice to knowfreq 31%

basics

~20 s

Search optimization builds and maintains a persistent search access path so highly selective point lookups on large tables return quickly without scanning most micro-partitions. It is wrong for scans and aggregations over many rows, and it costs both storage and serverless maintenance credits.

open as a page