Virtual Warehouses: Compute, Sizing & Auto-Scaling
Learn how Snowflake virtual warehouses work, how to size them, and how auto-scaling handles concurrency.
20+ years shipping high-throughput database systems. Drawn from code that ran under real load.
- ✓Basic understanding of SQL (SELECT, INSERT, etc.)
- ✓A Snowflake account with access to create warehouses
Snowflake virtual warehouses are clusters of compute resources that execute queries. They can be sized from X-Small to 6X-Large, support auto-scaling (multi-cluster) for concurrency, and can be set to auto-suspend to save costs. Key settings: warehouse size, multi-cluster configuration, and auto-suspend timeout.
Think of a virtual warehouse like a fleet of delivery trucks. A small warehouse is one small truck (X-Small), a large warehouse is a big truck (X-Large). Auto-scaling adds more trucks when there are many packages (queries) to deliver. Auto-suspend parks the trucks when no deliveries are needed, saving fuel (credits).
Snowflake's architecture separates storage and compute, allowing you to scale compute independently. Virtual warehouses are the compute layer—they process queries, load data, and perform DML operations. Choosing the right warehouse size and configuration is critical for performance and cost. A warehouse too small causes slow queries; too large wastes credits. Auto-scaling (multi-cluster) handles variable concurrency, automatically adding clusters when queries queue up. This tutorial covers everything you need to know: sizing guidelines, multi-cluster setup, auto-suspend, and real-world debugging. By the end, you'll be able to design cost-effective, performant warehouses for your workloads.
What is a Virtual Warehouse?
A virtual warehouse is a cluster of compute resources (CPU, memory, and storage) that Snowflake uses to execute SQL queries and perform DML operations. It is separate from storage, so you can scale compute independently. Each warehouse can be sized from X-Small (1 node) to 6X-Large (128 nodes). You can create multiple warehouses for different workloads (e.g., ETL, BI, development) and they can be suspended when not in use to save credits. Key properties: size, auto-suspend, auto-resume, and multi-cluster (for concurrency).
Sizing a Warehouse: How to Choose the Right Size
Choosing the right warehouse size depends on the workload. For small data loads or simple queries, X-Small or Small is sufficient. For complex aggregations on large tables, consider Large or larger. A common approach: start with Medium, monitor query performance, and adjust. Use the QUERY_HISTORY view to check bytes_spilled_to_remote_storage—if >0, the warehouse is too small. Also check average execution time. Rule of thumb: double the size until spillage disappears or performance plateaus.
Auto-Suspend and Auto-Resume: Saving Credits
Auto-suspend automatically suspends a warehouse after a period of inactivity (default 10 minutes). Auto-resume starts it again when a query is submitted. This is critical for cost savings—idle warehouses still consume credits. Set auto-suspend to a low value (e.g., 60 seconds) for development warehouses. For production, 5-10 minutes is common to avoid frequent restarts. You can also manually suspend warehouses with ALTER WAREHOUSE ... SUSPEND.
Multi-Cluster Warehouses: Handling Concurrency
Multi-cluster warehouses allow Snowflake to automatically add or remove clusters (up to a max) based on query concurrency. This is ideal for variable workloads like BI dashboards. Configure MIN_CLUSTER_COUNT and MAX_CLUSTER_COUNT. When queries queue, Snowflake adds clusters up to MAX. When concurrency drops, clusters are removed. Each cluster is a full warehouse of the specified size, so costs multiply. Use multi-cluster only when concurrency is unpredictable.
Best Practices for Warehouse Configuration
- Use separate warehouses for different workloads (ETL, BI, ad-hoc). 2. Start with X-Small and scale up based on monitoring. 3. Set auto-suspend to 1-5 minutes for dev, 5-10 for prod. 4. Enable multi-cluster only when concurrency is an issue. 5. Use resource monitors to set credit quotas. 6. Regularly review warehouse usage in ACCOUNT_USAGE views. 7. Consider using 'Warehouse Sizing' recommendations from Snowflake's UI.
Real-World Example: ETL vs. BI Workloads
Consider a company with two main workloads: daily ETL that loads and transforms large tables, and a BI dashboard with many concurrent users. For ETL, use a Large warehouse (or bigger) to process data quickly, with auto-suspend set to 10 minutes (since it runs once daily). For BI, use a Medium multi-cluster warehouse with MIN=1, MAX=5 to handle variable concurrency, auto-suspend 5 minutes. This separation ensures ETL doesn't impact BI performance and costs are isolated.
The $10,000 Query: How an Oversized Warehouse Burned Credits
- Match warehouse size to query complexity and data volume.
- Use X-Small or Small for development and testing.
- Set resource monitors to alert on unexpected credit spikes.
- Leverage auto-suspend (e.g., 5 minutes) to avoid idle costs.
- Monitor warehouse usage with ACCOUNT_USAGE views.
SELECT * FROM TABLE(INFORMATION_SCHEMA.QUERY_HISTORY_BY_WAREHOUSE(WAREHOUSE_NAME=>'MY_WH', RESULT_LIMIT=>10)) ORDER BY START_TIME DESC;SELECT query_id, warehouse_size, credits_used, bytes_spilled_to_remote_storage FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY WHERE warehouse_name='MY_WH' AND start_time > DATEADD('hour', -1, CURRENT_TIMESTAMP());| File | Command / Code | Purpose |
|---|---|---|
| create_warehouse.sql | CREATE WAREHOUSE my_wh | What is a Virtual Warehouse? |
| check_spillage.sql | SELECT query_id, warehouse_size, bytes_spilled_to_remote_storage, execution_time | Sizing a Warehouse |
| alter_auto_suspend.sql | ALTER WAREHOUSE my_wh SET AUTO_SUSPEND = 60; | Auto-Suspend and Auto-Resume |
| create_multi_cluster.sql | CREATE WAREHOUSE bi_wh | Multi-Cluster Warehouses |
| resource_monitor.sql | CREATE RESOURCE MONITOR daily_limit | Best Practices for Warehouse Configuration |
| etl_bi_setup.sql | CREATE WAREHOUSE etl_wh | Real-World Example |
Key takeaways
Common mistakes to avoid
4 patternsUsing a single warehouse for all workloads
Setting auto-suspend too high (e.g., 1 hour)
Over-provisioning warehouse size for small queries
Enabling multi-cluster without monitoring
Interview Questions on This Topic
What is a Snowflake virtual warehouse?
Frequently Asked Questions
20+ years shipping high-throughput database systems. Drawn from code that ran under real load.
That's Snowflake. Mark it forged?
3 min read · try the examples if you haven't