Snowflake Architecture: Multi-Cluster Shared Data & Virtual Warehouses
Architecture Diagram 1: Complete Snowflake Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β SNOWFLAKE CLOUD DATA PLATFORM β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β CONSUMPTION LAYER β β
β β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββββββββββ β β
β β βBI Tools β β SQL β β ODBC/ β β Snowflake β β β
β β βTableau β β Client β β JDBC β β Connector β β β
β β βPower BI β β worksheetβ β Driver β β (Python/Java) β β β
β β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββββββββββ β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β βΌ β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β CLOUD SERVICES LAYER β β
β β βββββββββββββββ βββββββββββββββ βββββββββββββββ ββββββββββββ β β
β β β Authenticationβ β Infrastructureβ β Metadata β β Security β β β
β β β & Access β β Management β β Managementβ β Controls β β β
β β β Management β β β β β β β β β
β β βββββββββββββββ βββββββββββββββ βββββββββββββββ ββββββββββββ β β
β β βββββββββββββββ βββββββββββββββ ββββββββββββββββββββββββββββββ β β
β β β Query β β Optimizer β β Service Engineering β β β
β β β Processing β β & Planning β β (Global Service) β β β
β β βββββββββββββββ βββββββββββββββ ββββββββββββββββββββββββββββββ β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β βΌ β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β QUERY PROCESSING LAYER β β
β β β β
β β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
β β β VIRTUAL WAREHOUSE CLUSTER β β β
β β β β β β
β β β βββββββββββββ βββββββββββββ βββββββββββββ ββββββββββββ β β β
β β β β Node 1 β β Node 2 β β Node 3 β β Node N β β β β
β β β β βββββββββ β β βββββββββ β β βββββββββ β β ββββββββ β β β β
β β β β βCache β β β βCache β β β βCache β β β βCache β β β β β
β β β β βEngine β β β βEngine β β β βEngine β β β βEngineβ β β β β
β β β β βββββββββ β β βββββββββ β β βββββββββ β β ββββββββ β β β β
β β β βββββββββββββ βββββββββββββ βββββββββββββ ββββββββββββ β β β
β β β β β β
β β β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β
β β β β RESULT CACHE / SERVICE RESULT CACHE β β β β
β β β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β
β β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
β β β β
β β βββββββββββββββββββ βββββββββββββββββββ ββββββββββββββββββ β β
β β β Warehouse 1 β β Warehouse 2 β β Warehouse N β β β
β β β (XS-Small) β β (Large) β β (Multi-Cluster)β β β
β β βββββββββββββββββββ βββββββββββββββββββ ββββββββββββββββββ β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β βΌ β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β STORAGE LAYER β β
β β β β
β β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
β β β MICRO-PARTITION STORAGE β β β
β β β β β β
β β β βββββββββββ βββββββββββ βββββββββββ βββββββββββ ββββββββ β β β
β β β βMicro- β βMicro- β βMicro- β βMicro- β βMicro-β β β β
β β β βPartitionβ βPartitionβ βPartitionβ βPartitionβ β .. β β β β
β β β β (001) β β (002) β β (003) β β (004) β β β β β β
β β β β 50-500MBβ β 50-500MBβ β 50-500MBβ β 50-500MBβ β β β β β
β β β βββββββββββ βββββββββββ βββββββββββ βββββββββββ ββββββββ β β β
β β β β β β
β β β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β
β β β β Columnar Storage Format (Parquet-like) β β β β
β β β β β’ Column groups β’ Run-length encoding β β β β
β β β β β’ Dictionary encoding β’ Delta encoding β β β β
β β β β β’ ZSTD compression β’ Metadata statistics β β β β
β β β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β
β β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
β β β β
β β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
β β β CLOUD BLOB STORAGE (S3/Azure/GCS) β β β
β β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β
β β β β β’ Automatic compression (typically 4-6x) β β β β
β β β β β’ Encryption at rest (AES-256) β β β β
β β β β β’ Pointers maintained in metadata β β β β
β β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β
β β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Architecture Diagram 2: Micro-Partition & Pruning Strategy
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MICRO-PARTITION PRUNING STRATEGY β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β SQL Query: SELECT * FROM sales WHERE region = 'US' AND amount > 1000 β
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β METADATA LAYER β β
β β β β
β β Micro-Partition Statistics: β β
β β ββββββββββββββββ¬βββββββββ¬ββββββββββ¬ββββββββββ¬ββββββββββββββ β β
β β β Partition ID β Region β Amount β Date β Rows β β β
β β ββββββββββββββββΌβββββββββΌββββββββββΌββββββββββΌββββββββββββββ€ β β
β β β MP_001 β US/EU β 100-5K β 2024-Q1 β 45,000 β β β
β β β MP_002 β US/ASIAβ 500-10K β 2024-Q2 β 52,000 β β β
β β β MP_003 β EU/APACβ 200-8K β 2024-Q3 β 38,000 β β β
β β β MP_004 β US/EU β 1K-15K β 2024-Q4 β 61,000 β β β
β β β MP_005 β ASIA β 50-2K β 2024-Q1 β 29,000 β β β
β β ββββββββββββββββ΄βββββββββ΄ββββββββββ΄ββββββββββ΄ββββββββββββββ β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β βΌ β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β PRUNING PHASE 1: Partition Pruning β β
β β β β
β β Filter: region = 'US' β β
β β β β
β β MP_001 [US/EU] βββββββββββ β β
β β MP_002 [US/ASIA] βββββββββΌββββ PRUNED βββΆ Candidate Partitions β β
β β MP_003 [EU/APAC] ββββX β (3 of 5) β β
β β MP_004 [US/EU] βββββββββββ€ β β
β β MP_005 [ASIA] βββββββX β β β
β β β β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β βΌ β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β PRUNING PHASE 2: Column Pruning β β
β β β β
β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
β β β SELECT * FROM sales β β β
β β β βββββββββββββββββββββ β β β
β β β Column Groups in Micro-Partition: β β β
β β β β β β
β β β CG1: [region, country, city] βββββββΆ READ (region needed) β β β
β β β CG2: [amount, currency] βββββββΆ READ (amount needed) β β β
β β β CG3: [date, timestamp] βββββββΆ SKIPPED (not needed)β β β
β β β CG4: [product_id, sku] βββββββΆ SKIPPED (not needed)β β β
β β β CG5: [customer_id, email] βββββββΆ SKIPPED (not needed)β β β
β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β βΌ β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β PRUNING PHASE 3: Row-Level Filtering β β
β β β β
β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
β β β Amount Column Data in MP_001: β β β
β β β β β β
β β β Run-Length Encoded: β β β
β β β [100, 150, 200, 250, 300, 350, 400, 450, 500, 550, ...] β β β
β β β β² β β β
β β β β β β β
β β β Amount > 1000: Skip values 100-999 β β β
β β β Scan from index ~20 only (1000/50 increment) β β β
β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β RESULT: 3 micro-partitions scanned β 2 columns read β rows filtered β
β EFFICIENCY: ~85% data skipped through metadata-based pruning β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Architecture Diagram 3: Virtual Warehouse Scaling & Multi-Cluster
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β VIRTUAL WAREHOUSE MULTI-CLUSTER SCALING β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β MULTI-CLUSTER WAREHOUSE: Analytics_WH (Min: 1, Max: 5) β
β β
β CLUSTER 1 (Primary) CLUSTER 2 (Auto-Started) β
β βββββββββββββββββββββββββββ βββββββββββββββββββββββββββ β
β β Warehouse: WH_1 β β Warehouse: WH_2 β β
β β Size: X-Large β β Size: X-Large β β
β β Status: ACTIVE β β Status: ACTIVE β β
β β β β β β
β β ββββββββββββββββββββββ β β ββββββββββββββββββββββ β β
β β β Node Pool: 8 nodesβ β β β Node Pool: 8 nodesβ β β
β β β ββββββββββββββββ β β β β ββββββββββββββββ β β β
β β β βN1ββN2ββN3ββN4β β β β β βN5ββN6ββN7ββN8β β β β
β β β ββββββββββββββββ β β β β ββββββββββββββββ β β β
β β β ββββββββββββββββ β β β β ββββββββββββββββ β β β
β β β βN9ββ10ββ11ββ12β β β β β β13ββ14ββ15ββ16β β β β
β β β ββββββββββββββββ β β β β ββββββββββββββββ β β β
β β ββββββββββββββββββββββ β β ββββββββββββββββββββββ β β
β β β β β β
β β Queue: 15 queries β β Queue: 8 queries β β
β β Running: 8 queries β β Running: 8 queries β β
β β Avg Wait: 2.3s β β Avg Wait: 1.1s β β
β βββββββββββββββββββββββββββ βββββββββββββββββββββββββββ β
β β
β βββββββββββββββββββββββββββ βββββββββββββββββββββββββββ β
β β Warehouse: WH_3 β β Warehouse: WH_4 β (Standby) β
β β Status: STANDBY β β Status: STANDBY β β
β β β β β β
β β Not yet started β β Not yet started β β
β β (Will start if queue β β (Will start if queue β β
β β > 10 for > 3 min) β β > 10 for > 3 min) β β
β βββββββββββββββββββββββββββ βββββββββββββββββββββββββββ β
β β
β SCALING POLICY: β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Scale UP (Larger nodes): Scale OUT (More clusters): β β
β β βββββββββββββββββββββββ ββββββββββββββββββββββββββββ β β
β β β’ Query uses 1 cluster β’ Queue depth > 10 β β
β β β’ More CPU/Memory per node β’ Sustained for > 3 minutes β β
β β β’ Better for single queries β’ Better for concurrent queries β β
β β β’ XS β S β M β L β XL β’ Auto-scale to Max clusters β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β AUTO-SUSPEND BEHAVIOR: β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Time β Cluster 1 β Cluster 2 β Cluster 3 β Cluster 4 β β
β β βββββββββββββββΌββββββββββββΌββββββββββββΌββββββββββββΌββββββββββ β β
β β 0:00 (start) β ACTIVE β --- β --- β --- β β
β β 0:05 (heavy) β ACTIVE β ACTIVE β --- β --- β β
β β 0:10 (peak) β ACTIVE β ACTIVE β ACTIVE β --- β β
β β 0:15 (drop) β ACTIVE β ACTIVE β --- β --- β β
β β 0:20 (idle) β ACTIVE β --- β --- β --- β β
β β 0:25 (idle) β SUSPENDED β --- β --- β --- β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
A micro-partition is a compressed, columnar data chunk (50β500 MB uncompressed) that serves as Snowflake's fundamental storage unit. Each micro-partition stores metadata including min/max values per column, distinct counts, and null counts, enabling partition pruning β skipping irrelevant micro-partitions during query execution.
A virtual warehouse is an independent compute cluster of 1β128 nodes, each containing CPU cores, RAM, and local SSD cache. Warehouses execute SQL queries and DML operations, scaling independently of storage. Multiple warehouses can access the same data simultaneously without contention.
Snowflake's compute-storage separation means warehouses are ephemeral β they can be started, stopped, or resized independently of persistent cloud storage (S3/Azure/GCS). This enables true multi-tenancy where different workloads use isolated compute resources.
- Three-layer design: Cloud Services (metadata/optimization), Query Processing (warehouses), Storage (micro-partitions)
- Micro-partition pruning eliminates 80β95% of data before scanning via metadata
- Multi-cluster warehouses auto-scale from 1 to N clusters based on queue depth
- Result cache accelerates repeated identical queries with zero compute
- Compression ratio of 4β6Γ across all data types reduces storage costs
Detailed Explanation
Snowflake's architecture represents a paradigm shift in cloud data warehousing, fundamentally rethinking how compute and storage interact in a distributed system. At its core, Snowflake implements a multi-cluster shared data architecture that completely separates compute resources from persistent cloud storage, enabling independent scaling of each layer without the traditional trade-offs that plagued earlier data warehouse systems.
The Three-Layer Architecture
Snowflake's architecture consists of three distinct but interconnected layers, each serving a specific purpose in the overall system design. The cloud services layer handles all metadata operations, query parsing, optimization, and security enforcement. This layer is fully managed by Snowflake and operates across all availability zones within a region, ensuring high availability and fault tolerance. The services layer maintains a centralized metadata store that tracks all objects, access control policies, and transaction states without requiring users to manage any infrastructure.
The query processing layer contains virtual warehouses that execute SQL queries and DML operations. Each virtual warehouse is an independent compute cluster consisting of multiple nodes, each with its own CPU, memory, and local SSD cache. Virtual warehouses can be scaled up (increasing node size) or scaled out (adding more clusters) independently of each other and the storage layer. This separation enables true multi-tenancy where different departments or workloads can use dedicated warehouses without resource contention.
The storage layer utilizes a revolutionary micro-partitioning scheme that automatically organizes data into compressed, columnar micro-partitions ranging from 50MB to 500MB in size. Unlike traditional partitioning, micro-partitions are automatically managed and do not require explicit definition by users. Each micro-partition maintains rich metadata including column-level min/max values, distinct counts, and null counts, enabling sophisticated partition pruning during query execution.
Micro-Partitioning and Automatic Clustering
Snowflake's micro-partitioning system operates transparently, automatically organizing data as it's ingested. When data is loaded, Snowflake divides it into micro-partitions and applies columnar compression using a combination of run-length encoding, dictionary encoding, delta encoding, and ZSTD compression. This typically achieves 4-6x compression ratios compared to raw data sizes.
The automatic clustering feature continuously optimizes data placement based on query patterns. When users define clustering keys, Snowflake automatically reorganizes micro-partitions to maximize data locality for those key columns. This background process runs asynchronously without impacting query performance and continuously adapts as data volumes grow and query patterns evolve.
Virtual Warehouse Architecture
Virtual warehouses in Snowflake are not traditional fixed-size compute clusters. Instead, they are elastic compute resources that can dynamically scale based on workload demands. Each warehouse consists of a pool of nodes, where each node contains CPU cores, RAM, and local SSD cache. The cache stores frequently accessed data and intermediate query results, reducing the need to fetch data from remote storage.
Multi-cluster warehouses extend this concept by automatically managing multiple independent clusters under a single logical warehouse. When the primary cluster becomes overloaded (typically measured by queue depth exceeding a threshold), Snowflake automatically starts additional clusters to handle the load. When the load decreases, clusters are automatically suspended to reduce costs. This automatic scaling happens transparently without any user intervention.
Data Flow and Query Execution
When a query arrives, the cloud services layer parses the SQL, generates an optimized query plan, and determines which virtual warehouse should execute it. The optimizer uses micro-partition metadata to perform sophisticated partition pruning, eliminating entire micro-partitions that cannot contain qualifying rows. This pruning can often eliminate 80-95% of data before any actual data scanning occurs.
During execution, the virtual warehouse fetches only the required micro-partitions from cloud storage, caches them locally, and processes them in parallel across all available nodes. Results are cached at multiple levels (node-level cache, warehouse-level cache, and global result cache) to accelerate subsequent identical or similar queries.
Key Concepts Table
| Component | Description | Scaling Behavior | Cost Model |
|---|---|---|---|
| Cloud Services | Metadata, security, query optimization | Automatic, serverless | Included in compute cost |
| Virtual Warehouse | Query execution, DML processing | Manual or auto-scale | Per-second billing (60s minimum) |
| Micro-Partition | 50-500MB compressed columnar chunks | Automatic creation | Storage cost only |
| Result Cache | Query result caching | Automatic invalidation | No additional cost |
| Storage | Persistent cloud blob storage | Automatic expansion | Per TB per month |
| Warehouse Size | vCPU | Memory | Max Concurrent Queries |
|---|---|---|---|
| X-Small | 1 | 2 GB | 1 |
| Small | 2 | 4 GB | 2 |
| Medium | 4 | 8 GB | 4 |
| Large | 8 | 16 GB | 8 |
| X-Large | 16 | 32 GB | 16 |
| 2X-Large | 32 | 64 GB | 32 |
| 3X-Large | 64 | 128 GB | 64 |
| 4X-Large | 128 | 256 GB | 128 |
| Metric | Value | Description |
|---|---|---|
| Compression Ratio | 4-6x | Average compression across all data types |
| Micro-Partition Size | 50-500 MB | Target size after compression |
| Partition Pruning | 80-95% | Average data skipped during queries |
| Result Cache Hit Rate | 30-70% | Depends on query repetition patterns |
| Fail-Safe Retention | 7 days | Additional protection beyond Time Travel |
Code Examples
-- Example 1: Create a multi-cluster warehouse with specific configuration
CREATE WAREHOUSE analytics_wh
WAREHOUSE_SIZE = 'xlarge'
MIN_CLUSTER_COUNT = 1
MAX_CLUSTER_COUNT = 5
SCALING_POLICY = 'ECONOMY'
AUTO_SUSPEND = 300
AUTO_RESUME = TRUE
INITIALLY_SUSPENDED = FALSE
RESOURCE_MONITOR = 'analytics_monitor'
COMMENT = 'Multi-cluster warehouse for analytics workloads';
-- Example 2: Configure warehouse with advanced settings
CREATE WAREHOUSE etl_wh
WAREHOUSE_SIZE = '2xlarge'
MIN_CLUSTER_COUNT = 2
MAX_CLUSTER_COUNT = 4
SCALING_POLICY = 'STANDARD'
AUTO_SUSPEND = 60
AUTO_RESUME = TRUE
STATEMENT_QUEUED_TIMEOUT_IN_SECONDS = 3600
STATEMENT_TIMEOUT_IN_SECONDS = 86400
COMMENT = 'ETL warehouse with aggressive scaling';
-- Example 3: Query micro-partition metadata
SELECT
partition_id,
row_count,
uncompressed_bytes,
compressed_bytes,
(uncompressed_bytes / compressed_bytes) as compression_ratio,
created_time,
last_modified_time
FROM TABLE(INFORMATION_SCHEMA.PARTITION_HISTORY(
TABLE_NAME => 'sales_data',
START_TIME => DATEADD(day, -7, CURRENT_TIMESTAMP())
))
ORDER BY created_time DESC;
-- Example 4: Analyze warehouse performance metrics
SELECT
warehouse_name,
warehouse_size,
cluster_number,
AVG(queries_completed) as avg_queries,
AVG(queued_overload_queries) as avg_queued,
AVG(execution_time_ms) / 1000 as avg_exec_seconds,
SUM(credits_used) as total_credits,
AVG(bytes_scanned) / 1024 / 1024 / 1024 as avg_gb_scanned
FROM SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY
WHERE start_time >= DATEADD(day, -30, CURRENT_TIMESTAMP())
GROUP BY 1, 2, 3
ORDER BY total_credits DESC;
-- Example 5: Monitor auto-scaling events
SELECT
warehouse_name,
event_name,
event_timestamp,
event_reason,
cluster_number
FROM TABLE(INFORMATION_SCHEMA.WAREHOUSE_LOAD_HISTORY(
START_TIME => DATEADD(hour, -24, CURRENT_TIMESTAMP())
))
WHERE event_name IN ('RESUME', 'SUSPEND', 'ADD_CLUSTER', 'REMOVE_CLUSTER')
ORDER BY event_timestamp DESC;
-- Example 6: Analyze partition pruning effectiveness
SELECT
query_id,
query_text,
partitions_scanned,
partitions_total,
(partitions_scanned / partitions_total) * 100 as scan_percentage,
bytes_scanned / 1024 / 1024 as mb_scanned,
compilation_time_ms,
execution_time_ms
FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY
WHERE start_time >= DATEADD(day, -1, CURRENT_TIMESTAMP())
AND partitions_total > 0
ORDER BY scan_percentage DESC
LIMIT 100;
Performance Metrics
| Metric | Target | Warning | Critical | Description |
|---|---|---|---|---|
| Query Queue Depth | < 5 | 5-10 | > 10 | Number of queries waiting to execute |
| Cluster Scaling Time | < 30s | 30-60s | > 60s | Time to start additional cluster |
| Warehouse Utilization | 60-80% | 80-95% | > 95% | CPU/Memory utilization |
| Partition Pruning | > 80% | 60-80% | < 60% | Percentage of partitions eliminated |
| Cache Hit Rate | > 50% | 30-50% | < 30% | Result cache effectiveness |
| Auto-Suspend Delay | 60-300s | 300-600s | > 600s | Time before warehouse suspends |
Best Practices
-
Right-size warehouses: Start with Medium for ad-hoc queries, scale up for batch ETL. Monitor queue depth to identify under-provisioned warehouses.
-
Use multi-cluster warehouses: Set MIN_CLUSTER_COUNT=1 and MAX_CLUSTER_COUNT=3-5 for concurrent workloads. Use SCALING_POLICY=ECONOMY for cost optimization.
-
Implement warehouse isolation: Create separate warehouses for different workloads (ETL, reporting, ad-hoc) to prevent resource contention and enable independent scaling.
-
Configure appropriate timeouts: Set STATEMENT_QUEUED_TIMEOUT for queries that shouldn't run indefinitely and STATEMENT_TIMEOUT to kill long-running queries.
-
Leverage result cache: Ensure identical queries can hit the cache by avoiding non-deterministic functions. Use QUERY_TAG to group similar queries.
-
Monitor partition pruning: Use QUERY_HISTORY to identify queries with poor pruning (< 60% data elimination). Consider adding clustering keys for frequently filtered columns.
-
Implement resource monitors: Set up alerts for credit consumption to prevent unexpected costs. Use MAX_CREDIT_QUOTA per warehouse for budget control.
-
Use automatic clustering: Define clustering keys on large tables (100GB+) that are frequently filtered. Start with low cardinality columns used in WHERE/JOIN clauses.
-
Optimize data placement: Distribute data across micro-partitions based on query patterns. Regularly review CLUSTERING_INFORMATION() for clustering depth and overlap metrics.
-
Cache management: Understand result cache invalidation rules (data modifications, DDL changes). Use PERSISTENT_RESULT_CACHE_VARCHAR for long-lived result sets.
See Also
- PySpark Iceberg - Iceberg table format integration
- Delta Lake on Databricks - Delta Lake table format comparison
- Data Warehouse Concepts - Data warehouse design principles