πŸŽ‰ 75% of content is free forever β€” Unlock Premium from $10/mo β†’
CW
Search courses…
πŸ’Ό Servicesℹ️ Aboutβœ‰οΈ ContactView Pricing Plansfrom $10

Snowflake Architecture: Multi-Cluster Shared Data & Virtual Warehouses

🟒 Free Lesson

Advertisement

Snowflake Architecture: Multi-Cluster Shared Data & Virtual Warehouses

Architecture Diagram 1: Complete Snowflake Architecture

Snowflake Three-Layer ArchitectureConsumption LayerBI Tools β€’ SQL Client β€’ ODBC/JDBC β€’ ConnectorsUser queries submitted via drivers and APIsQuery SubmissionCloud ServicesAuthentication β€’ Optimization β€’ Metadata β€’ SecurityFully managed across all availability zonesQuery RoutingQuery ProcessingVirtual Warehouses β€’ Result Cache β€’ Multi-ClusterIndependent compute clusters, elastic scalingData AccessStorage LayerMicro-Partitions β€’ Columnar Format β€’ Cloud Blob StoragePersistent, compressed, automatic management

Architecture Diagram 2: Micro-Partition & Pruning Strategy

Three-Phase Partition PruningMicro-PartitionMetadataMin/Max ‒ Distinct ‒ Null countsStatisticsPhase 1: Partition PruningFilter by metadata→ Eliminate irrelevant partitionsCandidatesPhase 2: Column PruningRead only requiredcolumn groupsColumnsPhase 3: Row FilteringSkip rows viamin/max metadataRowsResult:~85% DataSkippedOnly qualifyingpartitions scanned

Architecture Diagram 3: Virtual Warehouse Scaling & Multi-Cluster

Multi-Cluster Warehouse Auto-ScalingCluster 1 (Primary)8 nodes, ACTIVE15 queries queuedCluster 2 (Auto-Start)8 nodes, ACTIVE8 queries queuedCluster 3 (Standby)Will start if queue> 10 for 3 minCluster 4 (Standby)Will start if queue> 10 for 3 min⬆ Scale UPXS β†’ S β†’ M β†’ L β†’ XLLarger nodes for bigger queries➑ Scale OUTMore clusters for concurrencyAuto-start/suspend based on queue

Architecture Diagram 4: Query Execution Lifecycle

Query Execution LifecycleParse & ValidateSQL Parser β†’ ASTSemantic Check β†’ OptimizerPlan GenerationCache Check β†’ PruningCompile Execution PlanDistributed ExecCoordinator β†’ WorkersParallel Scan β†’ AggregateResult ReturnResult Set β†’ CacheReturn to Client

Architecture Diagram 5: Three-Layer Architecture Stack

Snowflake Three-Layer ArchitectureCloud Services LayerAuthentication | Optimization | Metadata | SecurityQuery Processing LayerVirtual Warehouses | Result Cache | Multi-ClusterStorage LayerMicro-Partitions | Columnar Format | Cloud Blob Storage

Architecture Diagram 6: Query Execution Lifecycle

Parse & ValidateSQL ParserOptimizerPlan GenerationPartition PruningColumn PruningDistributed ExecWorker NodesParallel ScanResult ReturnCache UpdateClient Delivery1. Parse SQL2. Optimize Plan3. Execute4. Return

Architecture Diagram 7: Cost Model & Credit Consumption

Snowflake Cost Model & OptimizationCost SourcesπŸ’» ComputePer-second billing (60s min)πŸ’Ύ StoragePer TB per monthπŸ”„ Data TransferCross-region / egress feesOptimization Levers⏸️ Auto-SuspendKill idle compute costsβš–οΈ Scaling PolicyEconomy vs Standard modeπŸš€ Result CacheZero compute for repeat queriesMonitoringπŸ“ˆ Resource MonitorsAlert on credit thresholdsπŸ“Š Usage DashboardTrack consumption by WH🏷️ Cost AttributionTag-based cost allocation

Why Snowflake? The Industry Context

Snowflake was founded in 2012 by three data warehouse veterans who saw a fundamental flaw in existing architectures: compute and storage were tightly coupled, forcing organizations to over-provision one to scale the other. Traditional warehouses like Teradata, Netezza, and Oracle Exadata required buying bigger appliances to handle more queries β€” even if storage was fine.

The Problem Snowflake Solves

Legacy Pain PointTraditional ApproachSnowflake's Solution
Scale compute independentlyBuy bigger appliance (vertical only)Separate compute layer, horizontal scaling
Multi-tenant isolationSeparate database instances per teamVirtual warehouses with shared storage
Zero-maintenanceDBA teams manage patches, backupsFully managed across all layers
Pay for what you useFixed license costs regardless of usagePer-second compute billing (60s minimum)
Cross-cloud portabilityRewrite for each cloud providerRun on AWS, Azure, or GCS with same SQL
Data sharingETL to external tables or FTPSecure data sharing without copying data

Who Uses Snowflake in Production?

  • Capital One: Migrated from Teradata to Snowflake for fraud detection analytics β€” reduced query times from minutes to seconds
  • Adobe: Processes 50+ billion customer experience events daily in Snowflake
  • Sony: Consolidated 30+ data warehouses into a single Snowflake deployment
  • Roche: Harmonized clinical trial data across 100+ countries with Snowflake's data sharing
  • Instacart: Powers real-time delivery optimization with Snowflake as the analytical backbone

Snowflake vs. The Competition

FeatureSnowflakeBigQueryRedshiftDatabricks SQL
ArchitectureSeparated compute/storageSeparated (serverless)Loosely coupledLakehouse (Spark)
Auto-scalingMulti-cluster (horizontal)Serverless (auto)Manual resizeServerless SQL
Time Travel90 days (Enterprise)7 days24 hours (limited)Via Delta Lake
Data SharingNative, zero-copyLimited (authorized views)Cross-accountDelta Sharing
Semi-structured dataVARIANT columnNested/repeatedSuperStructured streaming
Pricing modelCredit-based (per second)Per TB scannedNode-basedDBU-based

Key Insight: Snowflake's differentiator isn't just the technology β€” it's the ecosystem. Data sharing, data exchange (Snowflake Marketplace), and zero-copy cloning create network effects that make Snowflake more valuable as more organizations adopt it.


Real-World Case Study: Retail Analytics Platform

A major retailer processes 2TB of daily transaction data across 500 stores. Before Snowflake:

  • ETL took 6 hours β€” analysts waited until noon for morning data
  • Concurrent query limits β€” only 5 analysts could run reports simultaneously
  • Data freshness β€” decisions were based on yesterday's data

After migrating to Snowflake:

-- Before: Queries scanned full tables (10TB+), took 15+ minutes
SELECT store_id, SUM(revenue) 
FROM transactions 
WHERE date = CURRENT_DATE 
GROUP BY store_id;
-- Runtime: 14 minutes, scanned 10TB

-- After: Micro-partition pruning eliminates 95% of data
-- Partition pruning: only scans today's partitions (~200GB)
-- Runtime: 18 seconds

Architecture decisions made:

DecisionRationaleCost Impact
X-Small warehouse for ad-hoc queriesLow concurrency, low data volume~16/hour for Medium
Auto-suspend at 60 secondsQueries complete in <10 seconds70% compute cost reduction
Multi-cluster (1-3) for dashboardsPeak hours: 20 concurrent usersHandles peaks without over-provisioning
Clustering key on date, store_idMost queries filter by date and store40% faster queries, fewer bytes scanned
Data sharing with suppliersZero-copy access to sales dataEliminated 3 separate ETL pipelines

Results:

  • Query performance: 14 minutes β†’ 18 seconds (47x improvement)
  • Data freshness: End-of-day β†’ Near real-time (5-minute delay)
  • Analyst productivity: 5 concurrent β†’ 50+ concurrent users
  • Annual cost: 95K (Snowflake) β€” 47% reduction



Detailed Explanation

What is Snowflake's Architecture?

Snowflake implements a multi-cluster shared data architecture that completely separates compute from persistent cloud storage. This enables independent scaling of each layer without the trade-offs of traditional data warehouses.


The Three-Layer Architecture

Cloud Services Layer

  • Handles metadata operations, query parsing, optimization, and security
  • Fully managed by Snowflake across all availability zones
  • Maintains centralized metadata store (objects, access control, transactions)

Query Processing Layer

  • Contains virtual warehouses for SQL/DML execution
  • Each warehouse is independent (CPU, RAM, local SSD cache)
  • Scalable up (node size) or out (cluster count) independently

Storage Layer

  • Micro-partitioning: 50–500MB compressed columnar chunks
  • Automatic management β€” no user-defined partitions required
  • Rich metadata: min/max values, distinct counts, null counts per column

Micro-Partitioning and Automatic Clustering

FeatureDescription
CompressionRun-length, dictionary, delta, ZSTD β†’ 4–6Γ— ratio
Automatic OrganizationData organized transparently on ingestion
Clustering KeysUser-defined keys optimize data locality
Background ProcessRuns asynchronously, adapts to data/query patterns

Virtual Warehouse Architecture

  • Elastic compute β€” dynamically scales based on workload demands
  • Each node: CPU cores + RAM + local SSD cache for hot data
  • Multi-cluster warehouses auto-start/suspend clusters based on queue depth
  • True multi-tenancy: different workloads use isolated warehouses

Data Flow and Query Execution

  1. Cloud services layer parses SQL and generates optimized query plan
  2. Optimizer uses micro-partition metadata for partition pruning (80–95% data eliminated)
  3. Virtual warehouse fetches required micro-partitions from cloud storage
  4. Processes in parallel across all available nodes
  5. Results cached at node, warehouse, and global levels

Key Takeaway: Snowflake's separation of compute and storage enables true multi-tenancy, elastic scaling, and cost-efficient query execution through micro-partition pruning.

Key Concepts Table

ComponentDescriptionScaling BehaviorCost Model
Cloud ServicesMetadata, security, query optimizationAutomatic, serverlessIncluded in compute cost
Virtual WarehouseQuery execution, DML processingManual or auto-scalePer-second billing (60s minimum)
Micro-Partition50-500MB compressed columnar chunksAutomatic creationStorage cost only
Result CacheQuery result cachingAutomatic invalidationNo additional cost
StoragePersistent cloud blob storageAutomatic expansionPer TB per month
Warehouse SizevCPUMemoryMax Concurrent Queries
X-Small12 GB1
Small24 GB2
Medium48 GB4
Large816 GB8
X-Large1632 GB16
2X-Large3264 GB32
3X-Large64128 GB64
4X-Large128256 GB128
MetricValueDescription
Compression Ratio4-6xAverage compression across all data types
Micro-Partition Size50-500 MBTarget size after compression
Partition Pruning80-95%Average data skipped during queries
Result Cache Hit Rate30-70%Depends on query repetition patterns
Fail-Safe Retention7 daysAdditional 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

MetricTargetWarningCriticalDescription
Query Queue Depth< 55-10> 10Number of queries waiting to execute
Cluster Scaling Time< 30s30-60s> 60sTime to start additional cluster
Warehouse Utilization60-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 Delay60-300s300-600s> 600sTime before warehouse suspends

Best Practices

  1. Right-size warehouses: Start with Medium for ad-hoc queries, scale up for batch ETL. Monitor queue depth to identify under-provisioned warehouses.

  2. 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.

  3. Implement warehouse isolation: Create separate warehouses for different workloads (ETL, reporting, ad-hoc) to prevent resource contention and enable independent scaling.

  4. Configure appropriate timeouts: Set STATEMENT_QUEUED_TIMEOUT for queries that shouldn't run indefinitely and STATEMENT_TIMEOUT to kill long-running queries.

  5. Leverage result cache: Ensure identical queries can hit the cache by avoiding non-deterministic functions. Use QUERY_TAG to group similar queries.

  6. Monitor partition pruning: Use QUERY_HISTORY to identify queries with poor pruning (< 60% data elimination). Consider adding clustering keys for frequently filtered columns.

  7. Implement resource monitors: Set up alerts for credit consumption to prevent unexpected costs. Use MAX_CREDIT_QUOTA per warehouse for budget control.

  8. Use automatic clustering: Define clustering keys on large tables (100GB+) that are frequently filtered. Start with low cardinality columns used in WHERE/JOIN clauses.

  9. Optimize data placement: Distribute data across micro-partitions based on query patterns. Regularly review CLUSTERING_INFORMATION() for clustering depth and overlap metrics.

  10. Cache management: Understand result cache invalidation rules (data modifications, DDL changes). Use PERSISTENT_RESULT_CACHE_VARCHAR for long-lived result sets.


See Also

Need Expert Snowflake Help?

Get personalized tutoring, project support, or professional consulting.

Advertisement