Snowflake interview questionsQuestion 1 of 8
Snowflake interview question · Question 1 of 8
What are Snowflake virtual warehouses?
Short answer
A virtual warehouse is an independent compute cluster that runs queries on Snowflake's shared storage. You choose its size, and you pay only while it runs; auto-suspend stops it when idle and auto-resume starts it when a query arrives. Because warehouses are independent, different workloads, such as loading, transformations and dashboards, can each have their own warehouse without slowing each other down. You scale a warehouse up for heavy queries, and scale out with a multi-cluster warehouse when many people query at the same time.
Detailed explanation
A virtual warehouse is Snowflake’s unit of compute. Storage (micro-partitions) and cloud services (metadata, optimisation, security) are separate layers, so a warehouse holds no data of its own: it fetches the micro-partitions a query needs, caches them on local SSD while it runs, and returns results.
- Independent: each warehouse has its own nodes; a heavy transformation on one cannot slow dashboards on another, even on the same tables. (Locks are the exception: two
MERGEs on one table wait for each other whatever warehouses run them.) - Shared data: every warehouse reads the same storage, so adding one for a new team copies nothing.
- Sized in T-shirt steps: X-Small upwards, each step doubling compute and the credits per hour (Gen1 standard: 1, 2, 4, 8 …). New standard warehouses default to Gen2 where available, which also doubles per step but at a higher hourly rate, and turns on the query acceleration service.
- Billed while running: per second, with a 60-second minimum each time it resumes.
AUTO_SUSPEND(600 seconds by default when created with SQL) stops it when idle,AUTO_RESUMEstarts it on the next query. - Not every statement needs one: DDL,
SHOW, metadata-only answers such as an unfilteredCOUNT(*), and result-cache hits run in cloud services. - Two ways to scale: up (a bigger size) for heavy single queries that spill or run long; out (a multi-cluster warehouse, Enterprise Edition) for many concurrent queries that queue.
- Other kinds: Snowpark-optimized warehouses for memory-heavy Python, and adaptive warehouses (Adaptive Compute, Enterprise and above in selected regions), where Snowflake chooses size and cluster count itself and bills per query.
Example
One warehouse per workload, each sized and suspended for its pattern:
-- Snowflake SQL (not executed here)
CREATE WAREHOUSE load_wh WAREHOUSE_SIZE = 'XSMALL' AUTO_SUSPEND = 60 AUTO_RESUME = TRUE INITIALLY_SUSPENDED = TRUE;
CREATE WAREHOUSE transform_wh WAREHOUSE_SIZE = 'MEDIUM' AUTO_SUSPEND = 60 AUTO_RESUME = TRUE INITIALLY_SUSPENDED = TRUE;
CREATE WAREHOUSE bi_wh WAREHOUSE_SIZE = 'SMALL' AUTO_SUSPEND = 300 AUTO_RESUME = TRUE INITIALLY_SUSPENDED = TRUE
MIN_CLUSTER_COUNT = 1 MAX_CLUSTER_COUNT = 3 SCALING_POLICY = 'STANDARD'; -- Enterprise Edition
GRANT USAGE ON WAREHOUSE bi_wh TO ROLE reporting; -- control who can spend on which warehouse
SHOW WAREHOUSES; -- size, state, auto_suspend, generation
What the auto-suspend setting costs for a bursty workload: a Small Gen1 warehouse (2 credits per hour) receives three short bursts of work in an hour.
RATE_PER_HOUR = 2 # Small, Gen1 standard warehouse
bursts = [(0, 40), (300, 20), (1500, 30)] # (start second, seconds of work)
def billed_seconds(bursts, auto_suspend):
"""Each resume bills at least 60 s; the warehouse stays up auto_suspend seconds after the last query."""
total, running_until = 0, None
for start, work in bursts:
end = start + work
if running_until is not None and start <= running_until: # still running: extend
total += end + auto_suspend - running_until
else: # resumed: new 60 s minimum
total += max(60, work + auto_suspend)
running_until = end + auto_suspend
return total
for suspend in (60, 300, 600):
secs = billed_seconds(bursts, suspend)
print(f"AUTO_SUSPEND={suspend:3}: billed {secs:4} s = {RATE_PER_HOUR * secs / 3600:.3f} credits")
AUTO_SUSPEND= 60: billed 270 s = 0.150 credits
AUTO_SUSPEND=300: billed 950 s = 0.528 credits
AUTO_SUSPEND=600: billed 1550 s = 0.861 credits
The same 90 seconds of work costs almost six times more with the 600-second default than with 60 seconds, because the warehouse sits idle after each burst. The longer setting still makes sense for a BI warehouse whose users query every minute or two, where a warm cache and no resume delay matter more.
Trade-offs and pitfalls
- Shorter auto-suspend saves idle credits but empties the local cache on every suspend and adds resume latency; below 60 seconds it saves nothing because each resume bills a minute anyway.
- More warehouses isolate workloads and make cost attributable, but too many tiny ones each pay their own idle time; isolate by workload pattern, not per person.
- A bigger size only pays off if runtime roughly halves; otherwise fix pruning first (see sizing vs multi-cluster).
- Resource monitors can cap warehouse credits but not serverless features; budgets cover those.
Common mistakes
- Using one warehouse for everything, so loads, dbt runs and dashboards queue behind each other.
- Scaling up to fix queueing (scale out instead) or scaling out to fix one slow query (it still runs on one cluster).
- Leaving the 600-second default on batch warehouses.
- Forgetting that suspending clears the local cache, so the first queries after resume may be slower.
- Comparing generations by credits per hour instead of credits per job.
Progress is saved in this browser only. No account needed.

