The three layers
Cloud services
Always on, run by Snowflake
Login & security
Users, roles, MFA, keys
Metadata
Tables, micro-partition stats, history
Query optimizer
Plans each query, decides what to skip
Transactions
Keeps every read and write consistent
Query processing: virtual warehouses
You create, size, start and stop these
SHOPKART_WH
X-Small, loads and reports
BI_WH
Small, multi-cluster for dashboards
DS_WH
Large, for data science, run now and then
Database storage
Your data, kept once in cloud storage
Micro-partitions
Compressed, columnar, immutable files
| Layer | What it does | How you pay |
|---|---|---|
| Storage | Holds every table, compressed and split into micro-partitions | Per TB per month (after compression) |
| Compute (warehouses) | Runs queries, loads and transformations | Credits per second while running, 60-second minimum per start |
| Cloud services | Logins, metadata, query planning, security, transactions | Free up to 10% of the day's warehouse credits |
This is sometimes called a hybrid design. Like a shared-disk system, all warehouses see the same data. Like a shared-nothing system, each warehouse has its own machines, memory and local SSD cache, so it never fights another warehouse for power.
Storage: micro-partitions
When you load a table, Snowflake automatically splits it into micro-partitions: files of about 50–500 MB of raw data (much smaller once compressed). You never create them yourself. Three things to know:
- Columnar: each column is stored separately, so a query that needs 3 of 20 columns reads only those 3.
- Immutable: files are never changed. An UPDATE writes new micro-partitions and retires the old ones (that's what makes Time Travel possible in lesson 6).
- Self-describing: for every micro-partition, Snowflake records each column's min and max value, the number of distinct values and more.
That last point powers pruning. If a query asks for o_orderdate = '1995-06-17' and a micro-partition's dates run from 1992-01-01 to 1992-03-10, Snowflake doesn't even open it. Here it is on the sample data's 150-million-row orders table:
ALTER SESSION SET USE_CACHED_RESULT = FALSE; -- force real work for this test
-- 150 million orders. How many were placed on one day?
SELECT COUNT(*) AS orders_that_day
FROM snowflake_sample_data.tpch_sf100.orders
WHERE o_orderdate = '1995-06-17';
-- How much of the table did Snowflake actually open?
SELECT operator_statistics:pruning:partitions_scanned AS partitions_scanned,
operator_statistics:pruning:partitions_total AS partitions_total
FROM TABLE(GET_QUERY_OPERATOR_STATS(LAST_QUERY_ID()))
WHERE operator_type = 'TableScan';| ORDERS_THAT_DAY |
|---|
| 62365 |
| PARTITIONS_SCANNED | PARTITIONS_TOTAL |
|---|---|
| 16 | 291 |
Snowflake opened 16 of 291 micro-partitions, about 5% of the table, because that table's data arrived in date order. No index, no setup. GET_QUERY_OPERATOR_STATS shows the same numbers you'd see in the Query Profile tab in Snowsight. In lesson 10 you'll learn what to do when data isn't naturally sorted (clustering keys).
Compute: virtual warehouses
A warehouse is created with one SQL statement. Here's the one we use for this whole course:
-- Run once by an admin (ACCOUNTADMIN or a role with CREATE WAREHOUSE)
CREATE WAREHOUSE IF NOT EXISTS shopkart_wh
WAREHOUSE_SIZE = XSMALL -- smallest size: 1 credit per hour while running
AUTO_SUSPEND = 60 -- pause after 60 seconds of no queries
AUTO_RESUME = TRUE -- wake up automatically when a query arrives
INITIALLY_SUSPENDED = TRUE; -- don't start (or bill) until first used| Size | Credits per hour | Typical use |
|---|---|---|
| X-Small | 1 | Learning, small loads, light dashboards |
| Small | 2 | Daily ELT for a small company |
| Medium | 4 | Bigger transformations |
| Large | 8 | Heavy joins over hundreds of GB |
| X-Large → 6X-Large | 16 → 512 | Very large one-off jobs (each size doubles) |
Resizing is one line, and it applies to the next queries (running ones finish on the old size):
-- Need more power for a big job? Resize in one line (takes effect for new queries)
ALTER WAREHOUSE shopkart_wh SET WAREHOUSE_SIZE = SMALL;
SHOW WAREHOUSES LIKE 'SHOPKART_WH';
-- Back to the smallest size, and pause it now
ALTER WAREHOUSE shopkart_wh SET WAREHOUSE_SIZE = XSMALL;
ALTER WAREHOUSE shopkart_wh SUSPEND;| name | state | size | auto_suspend | auto_resume | min_cluster_count | max_cluster_count |
|---|---|---|---|---|---|---|
| SHOPKART_WH | STARTED | Small | 60 | true | 1 | 1 |
Scale up or scale out?
| Problem | Fix | How |
|---|---|---|
| One big query is slow | Scale up: a bigger size | ALTER WAREHOUSE ... SET WAREHOUSE_SIZE = LARGE |
| Many users, queries are queuing | Scale out: more clusters (Enterprise) | MIN_CLUSTER_COUNT = 1, MAX_CLUSTER_COUNT = 4 |
A multi-cluster warehouse adds identical clusters automatically when queries start to queue and removes them when the rush is over. The SCALING_POLICY decides how eager it is: STANDARD adds clusters quickly (best for users waiting on dashboards), ECONOMY waits until there's enough work to keep a new cluster busy (saves credits).
The three caches
Snowflake avoids repeating work at three levels. Here's the most dramatic one, tested on our account:
-- Revenue per shipping mode in 1995 (6 million rows to scan)
SELECT l_shipmode, ROUND(SUM(l_extendedprice * (1 - l_discount))) AS revenue
FROM snowflake_sample_data.tpch_sf1.lineitem
WHERE l_shipdate BETWEEN '1995-01-01' AND '1995-12-31'
GROUP BY l_shipmode
ORDER BY revenue DESC;
-- ...then run exactly the same query a second time.| L_SHIPMODE | REVENUE |
|---|---|
| REG AIR | 4766200040 |
| SHIP | 4760054445 |
| TRUCK | 4758514762 |
| AIR | 4750920070 |
| FOB | 4748878883 |
| RAIL | 4746064357 |
| 4730601164 |
-- How long did each run take, and how much data did it read?
SELECT LEFT(query_text, 50) AS query, total_elapsed_time AS ms, bytes_scanned
FROM TABLE(information_schema.query_history_by_user(RESULT_LIMIT => 30))
WHERE query_text ILIKE 'SELECT l_shipmode%'
ORDER BY start_time;| QUERY | MS | BYTES_SCANNED |
|---|---|---|
| SELECT l_shipmode, ROUND(SUM(l_extendedprice * (1 | 536 | 165208128 |
| SELECT l_shipmode, ROUND(SUM(l_extendedprice * (1 | 67 | 0 |
The first run read 165 MB in 536 ms. The second read 0 bytes in 67 ms: the answer came straight from the result cache, without using the warehouse at all.
| Cache | Where it lives | What it holds | Lasts |
|---|---|---|---|
| Result cache | Cloud services | Final results of queries | 24 h after last use (max 31 days); cleared when the data changes |
| Local disk (warehouse) cache | Each warehouse's SSD | Micro-partitions it has read recently | Until the warehouse suspends |
| Metadata | Cloud services | Row counts, min/max per column | Always; answers COUNT(*), MIN, MAX with no warehouse |
What happens when you run a query
1. Cloud services
Checks your role, checks the result cache, plans the query
2. Prune
Uses min/max metadata to pick only the micro-partitions needed
3. Warehouse
Resumes if needed, reads columns (from SSD cache or storage), computes
4. Result
Returned to you and saved in the result cache
🎯 Interview questions on this topic
Try to answer out loud first, then tap to check.
Q1Explain Snowflake's architecture.Fresher
Q2What is a micro-partition and why is it useful?Fresher
Q3Scale up vs scale out: when do you use each?1–3 yrs
Q4Describe Snowflake's caching layers.1–3 yrs
Q5How does warehouse billing work?1–3 yrs
Q6A team wants AUTO_SUSPEND = 1 second to save money. Good idea?3+ yrs
Key takeaways
- Data is stored once; warehouses come and go and never copy it.
- Snowflake is fast without indexes because it skips micro-partitions it doesn't need.
- Bigger size for big queries, more clusters for more users.
- Caches make repeat work free, so turn the result cache off when you benchmark.
Frequently asked questions
What is a virtual warehouse in Snowflake?
A named group of computers (a compute cluster) that runs your queries. It holds no data of its own: it reads tables from shared storage. You choose its size, and it costs credits only while it is running.
What is a micro-partition?
The small file Snowflake splits every table into automatically: about 50–500 MB of data before compression, stored by column. Snowflake records the min and max value of each column in every micro-partition, so queries can skip the ones that can't match.
Does a bigger warehouse always make queries faster?
Usually for big queries that scan a lot of data, roughly halving the time each size up, at double the credits per hour, so the cost stays about the same. Small queries don't get faster, they just cost more. For many users at once, add clusters (scale out) instead of size.
How long does the result cache last?
24 hours from the last time the result was used, up to 31 days in total. It's reused only if the query text is the same, the underlying data hasn't changed, and the query has no functions like CURRENT_TIMESTAMP() that change on every run.
Do I pay for the cloud services layer?
Only if it uses more than 10% of your warehouse compute for that day. For normal use that never happens, so it's effectively free.
🧠 Quick check: Snowflake architecture
1. Which layer stores your table data?
2. An X-Small warehouse costs 1 credit/hour. What does a Medium cost?
3. You run the same query twice and the data didn't change. The second run...
4. 100 analysts open a dashboard at 9 a.m. and queries start queuing. Best fix?
5. Pruning means...