Skip to main content

Snowflake: A Practical Guide to the Warehouse With a Meter

How separate storage and compute really work, and the warehouse, role and loading habits that keep Snowflake fast and the bill calm

Updated 10 min readMarkdown
Snowflake: A Practical Guide to the Warehouse With a Meter

On Friday evening someone on the data team starts a large warehouse to finish a backfill. The job ends at 7 pm. A dashboard that refreshes every five minutes keeps poking the same warehouse all weekend, so it never goes to sleep. On Monday the finance channel asks why the Snowflake bill jumped.

Nothing broke. Every query returned the right answer. The team simply forgot the one rule that matters most in Snowflake: storage is cheap and always on, compute is a meter that you start and stop.

Once you hold that picture in your head, most Snowflake advice stops being a list of tips and becomes common sense. This guide walks through it with SQL you can run.

What Snowflake is

Snowflake is a cloud data warehouse sold as a service. You do not install it or size servers for it. It runs on AWS, Azure or Google Cloud, in the region you pick when you create the account, and you talk to it in SQL.

Its design has three layers that are billed and scaled separately:

Layer What it does How you pay
Storage Holds your tables as compressed, columnar files By the amount stored each month
Virtual warehouses Clusters of compute that run your queries In credits, for the time each warehouse is running
Cloud services Sign-in, metadata, query planning, the result cache Mostly included, charged only when unusually heavy

A virtual warehouse is the confusing name for a compute cluster. It holds no data. You can have many of them reading the same tables at once, and they do not slow each other down.

Why teams choose it

  • Compute is separate from storage. The loading job, the analysts and the dashboards can each have their own warehouse, sized for their work, and none of them waits for the others.
  • Very little tuning. There are no indexes to design and no vacuum to schedule. Data is stored in small blocks called micro-partitions, and Snowflake keeps notes on what each one contains so it can skip most of them.
  • JSON without a schema fight. The VARIANT type stores semi-structured data and lets you query inside it with plain SQL.
  • Copies that cost nothing at first. A zero-copy clone of a table, a schema or a whole database is created in seconds and shares storage with the original until one of them changes.
  • Undo. Time Travel lets you query or restore data as it was earlier, and UNDROP brings back a dropped table.
  • Sharing. You can give another Snowflake account live, read-only access to tables without exporting files.

Where Snowflake fits, and where it does not

A strong choice for:

  • A central warehouse fed from many applications and tools
  • Analysts and dashboards with uneven, bursty usage
  • Mixed structured and JSON data
  • Teams that want a warehouse and do not want to run one
  • Sharing data sets with partners or customers

Look elsewhere when:

  • You need an application database. Thousands of small reads and writes per second, each needing a few milliseconds, is the job of PostgreSQL or MySQL. Snowflake's standard tables do not enforce primary or foreign keys; only NOT NULL is enforced.
  • Your data is small. If everything fits comfortably in one PostgreSQL server, or in DuckDB on a laptop, a warehouse adds cost and a second system to keep in sync.
  • You need sub-second dashboards for many users at once. A real-time analytics engine such as ClickHouse is built for that.
  • Your whole stack lives in one cloud and you want one bill. BigQuery on Google Cloud or Redshift on AWS will be closer to your other services.
  • Your data science team already lives in notebooks and Spark. Databricks may fit their habits better.

Using it the right way

Make every warehouse sleep

This is the setting that would have saved the weekend in the opening story.

CREATE WAREHOUSE reporting_wh
  WAREHOUSE_SIZE = 'XSMALL'
  AUTO_SUSPEND = 60
  AUTO_RESUME = TRUE
  INITIALLY_SUSPENDED = TRUE;

AUTO_SUSPEND is in seconds. After a minute with no queries the warehouse stops and stops costing money. AUTO_RESUME wakes it when the next query arrives, usually within a few seconds.

Start with the smallest size. Each step up doubles the credits used per hour. A bigger warehouse helps one heavy query finish sooner. It does not help when the problem is many people queueing; for that, add a second warehouse (or a multi-cluster warehouse on the Enterprise edition).

Put a ceiling on spending

A resource monitor watches credits and acts when a limit is reached. An account administrator creates it:

CREATE RESOURCE MONITOR monthly_cap WITH
  CREDIT_QUOTA = 100
  FREQUENCY = MONTHLY
  START_TIMESTAMP = IMMEDIATELY
  TRIGGERS ON 80 PERCENT DO NOTIFY
           ON 100 PERCENT DO SUSPEND;

ALTER WAREHOUSE reporting_wh SET RESOURCE_MONITOR = monthly_cap;

SUSPEND lets running queries finish and then stops the warehouse. Also cap runaway queries, because the default timeout is two days:

ALTER WAREHOUSE reporting_wh SET STATEMENT_TIMEOUT_IN_SECONDS = 1800;

Give people roles, not ACCOUNTADMIN

Access in Snowflake goes through roles. A user needs three things to read a table: use of a warehouse, use of the database and schema, and SELECT on the table.

CREATE ROLE analyst;

GRANT USAGE ON WAREHOUSE reporting_wh TO ROLE analyst;
GRANT USAGE ON DATABASE shop TO ROLE analyst;
GRANT USAGE ON SCHEMA shop.public TO ROLE analyst;
GRANT SELECT ON ALL TABLES IN SCHEMA shop.public TO ROLE analyst;
GRANT SELECT ON FUTURE TABLES IN SCHEMA shop.public TO ROLE analyst;

GRANT ROLE analyst TO USER asha;

The FUTURE TABLES grant covers tables created later, which is the line people forget.

Load in bulk, not row by row

Files go to a stage (a named storage location) and are loaded with COPY INTO.

CREATE STAGE orders_stage;

-- From the SnowSQL or Snowflake CLI client on your machine:
-- PUT file:///tmp/orders.csv @orders_stage;

COPY INTO orders
FROM @orders_stage
FILE_FORMAT = (TYPE = CSV SKIP_HEADER = 1 FIELD_OPTIONALLY_ENCLOSED_BY = '"')
ON_ERROR = ABORT_STATEMENT;

COPY INTO remembers which files it has already loaded, so running it again does not create duplicates. Thousands of single-row INSERT statements are slow and keep a warehouse awake. Batch them.

Query JSON with VARIANT

CREATE TABLE raw_events (payload VARIANT, loaded_at TIMESTAMP_NTZ);

SELECT
  e.payload:order_id::NUMBER   AS order_id,
  i.value:sku::STRING          AS sku,
  i.value:qty::NUMBER          AS qty
FROM raw_events e,
     LATERAL FLATTEN(input => e.payload:items) i;

A colon walks into the JSON, :: casts the value to a type, and FLATTEN turns an array into rows.

Clone and travel back in time

-- A full test copy, instantly, with no extra storage yet
CREATE TABLE orders_dev CLONE orders;

-- The table as it was one hour ago
SELECT * FROM orders AT (OFFSET => -3600);

-- Bring back a dropped table
UNDROP TABLE orders;

Time Travel keeps one day of history by default, and up to 90 days on the Enterprise edition if you set DATA_RETENTION_TIME_IN_DAYS. Longer retention means more storage on tables that change a lot.

Help Snowflake skip data

Snowflake prunes micro-partitions using the filter in your WHERE clause. So:

  • Select the columns you need. In a column store, SELECT * reads every column.
  • Filter on the column the data naturally arrives in, usually a date.
  • Do not wrap that column in a function. WHERE order_date >= '2026-03-01' prunes; WHERE TO_CHAR(order_date, 'YYYY-MM') = '2026-03' often cannot.

Clustering keys exist for very large tables whose natural order does not match how they are filtered. They cost credits to maintain, so add one only after the query profile shows poor pruning.

How the pricing shapes your habits

You pay for three things: storage per month, compute in credits, and some serverless features (automatic loading with Snowpipe, clustering maintenance and similar) that use credits on their own.

Compute is the part you control day to day:

  • A warehouse is billed per second while it runs, with a one-minute minimum each time it starts. A warehouse that wakes for a two-second query every five minutes pays for a minute each time.
  • Size doubles the rate. Running time multiplies it.
  • A repeated query whose data has not changed is answered from the result cache for 24 hours, with no warehouse at all.
  • The credit price depends on your edition and cloud region, so the same habits cost different amounts on different accounts.

To see where credits went:

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 warehouse_name
ORDER BY credits DESC;

The ACCOUNT_USAGE views lag by up to a few hours, and reading them needs a role that has been granted access to the SNOWFLAKE database.

Common mistakes

  • No auto-suspend, or a long one. The most expensive default to leave alone.
  • One big warehouse for everything. Loads, dashboards and ad hoc queries then compete, and you cannot tell who spent what.
  • Sizing up to fix queueing. Size helps heavy queries. Concurrency needs more clusters.
  • Quoted lowercase names. Unquoted names are stored in upper case. CREATE TABLE "orders" makes a table that must be quoted forever, and SELECT * FROM orders will not find it.
  • Trusting primary keys. They are recorded but not enforced on standard tables. Duplicates load without complaint, so check for them in your pipeline.
  • A dashboard on a short refresh timer. It can keep a warehouse awake around the clock for nobody.
  • Permanent tables for scratch data. Use CREATE TRANSIENT TABLE for staging data you can rebuild; it skips the extra recovery storage that permanent tables carry.
  • Working as ACCOUNTADMIN. Keep it for administration and give daily work a narrower role.

Quick reference

Task Command
Choose a warehouse USE WAREHOUSE reporting_wh;
Choose a role USE ROLE analyst;
List warehouses and their state SHOW WAREHOUSES;
Stop a warehouse now ALTER WAREHOUSE reporting_wh SUSPEND;
Resize ALTER WAREHOUSE reporting_wh SET WAREHOUSE_SIZE = 'SMALL';
List tables SHOW TABLES IN SCHEMA shop.public;
Describe a table DESCRIBE TABLE orders;
See the definition SELECT GET_DDL('TABLE', 'shop.public.orders');
What a role can do SHOW GRANTS TO ROLE analyst;
Current context SELECT CURRENT_ROLE(), CURRENT_WAREHOUSE(), CURRENT_DATABASE();

Treat every warehouse as a meter with a name, an owner, a size chosen on purpose and a short sleep timer, and Snowflake stays both fast and affordable.

Exploring Snowflake with CreamDB

Snowflake's own web interface is good. If you would rather keep Snowflake beside your other databases, CreamDB connects to it from a browser tab, with nothing to install.

  • Connect with your account identifier, username and password, and optionally a warehouse, database, schema and role. Signing in with a key pair is not offered yet, so check that your account's sign-in policy allows a password for that user.
  • Browse databases, schemas, tables (with row counts), views and columns in a tree.
  • Write SQL in an editor with autocomplete, formatting and history, and export results to CSV, JSON or Excel.
  • Ask in plain English, for example "revenue by month for the last year", and get the SQL, a result table and a chart.

The assistant only reads on its own. Any change waits as an approval card that you answer, and read-only mode on the server blocks writes. Queries run on the warehouse you chose, so give the connection a small one with auto-suspend.

The Status panel and the Users and roles page are not available for Snowflake. It is free to start.

About the author

  • CreamDB is a web-based database explorer with an AI assistant. Connect your databases, ask questions in plain English and get answers, tables and charts from any browser. Product news and tips here.

No comments yet. Be the first to comment.