# Snowflake Virtual Warehouses and Cost Control

> Storage and compute are separate: how warehouses are billed, when to scale up vs out, and the settings that stop a surprise bill.

- Source: https://akshaythakare.com/notes/snowflake/virtual-warehouses-and-cost
- Topic: Snowflake
- Level: beginner
- Reading time: 2 min
- Tags: snowflake, cost, warehouse, interview
- Updated: 2026-10-11

## Storage and compute are separate

- **Storage** holds your tables and is billed per TB per month.
- A **virtual warehouse** is a compute cluster that runs queries. It is billed in credits per second while running (minimum 60 seconds each time it starts).

Many warehouses can read the same data at the same time without blocking each other.

## Sizes

Each size up (XS → S → M → L …) **doubles** the compute and the credits per hour. A query that is CPU-bound often runs about twice as fast on the next size, so it can cost roughly the same while finishing sooner.

## Scale up or scale out?

| Symptom | Action |
| --- | --- |
| One big query is slow | **Scale up** (larger size) |
| Many users queue at the same time | **Scale out** (multi-cluster warehouse) |
| Queries spill to local or remote storage | Scale up: the working set does not fit in memory |

## Settings that save money

```sql
CREATE WAREHOUSE etl_wh
  WAREHOUSE_SIZE = 'SMALL'
  AUTO_SUSPEND = 60          -- seconds idle before stopping
  AUTO_RESUME = TRUE
  INITIALLY_SUSPENDED = TRUE;

CREATE RESOURCE MONITOR monthly_cap WITH CREDIT_QUOTA = 100
  TRIGGERS ON 90 PERCENT DO NOTIFY ON 100 PERCENT DO SUSPEND;
ALTER WAREHOUSE etl_wh SET RESOURCE_MONITOR = monthly_cap;
```

- Separate warehouses per workload (ELT, BI, data science), so you can see and cap each one.
- Watch `QUERY_HISTORY` for queries with large bytes scanned or spilling.

> **Tip: Interview framing**
>
> "Scale up for one heavy query, scale out for concurrency, auto-suspend everything, and put a resource monitor on each warehouse."
