Virtual warehouses and credits

Snowflake · Essentials · 10 min

Warehouse settings are the main lever on your Snowflake bill.

A virtual warehouse is a named compute cluster. Sizes go X-Small, Small, Medium, Large, X-Large and up to 6X-Large; each step doubles both the compute and the credits per hour (X-Small uses 1 credit per hour, Small 2, Medium 4, and so on).

Billing is per second, with a 60-second minimum each time a warehouse starts. Two settings keep that cheap:

  • AUTO_SUSPEND = 60 suspends the warehouse after 60 idle seconds. Suspended warehouses cost nothing.
  • AUTO_RESUME = TRUE starts it automatically when a query arrives, usually within a second or two.

Choosing a size: a bigger warehouse makes a single large query faster, roughly in proportion for scan-heavy work, so doubling size for half the runtime costs the same credits. It does not help many small queries waiting in line; that is a concurrency problem, solved by multi-cluster warehouses or separate warehouses per workload. Start small, check query times and the queue in the query history, and resize with ALTER WAREHOUSE at any time; running queries finish on the old size.

A warehouse also keeps a local cache of the data it has read. Suspending it drops that cache, so very short auto-suspend times can make BI dashboards slower. Values between 60 seconds and a few minutes are typical.

Example

CREATE WAREHOUSE IF NOT EXISTS analytics_wh
  WAREHOUSE_SIZE = 'XSMALL'
  AUTO_SUSPEND = 60            -- seconds idle before suspending
  AUTO_RESUME = TRUE
  INITIALLY_SUSPENDED = TRUE;

USE WAREHOUSE analytics_wh;

-- Temporarily scale up for a heavy backfill, then back down
ALTER WAREHOUSE analytics_wh SET WAREHOUSE_SIZE = 'LARGE';
-- ... run the backfill ...
ALTER WAREHOUSE analytics_wh SET WAREHOUSE_SIZE = 'XSMALL';

SHOW WAREHOUSES LIKE 'analytics_wh';
-- name: ANALYTICS_WH  state: SUSPENDED  size: X-Small  auto_suspend: 60 ...

Remember

  • Each size step doubles compute and credits per hour
  • Per-second billing with a 60-second minimum per resume
  • Always set AUTO_SUSPEND and AUTO_RESUME
  • Bigger size speeds big queries; more clusters help concurrency

Watch out for

  • Leaving a warehouse running with a long or no auto-suspend, burning credits while idle.

Check yourself

  1. A query takes 20 minutes on a Medium warehouse and scans a lot of data. Roughly what happens on a Large?
  2. Many small dashboard queries are queuing. What usually helps most?

Sign in to answer, see the explanations, and get this lesson back as a quick review later.

Official docs: docs.snowflake.com/en/user-guide/warehouses-overview