Loading Academy Hub...
Master enterprise performance tuning: diagnosing Local Disk Spill vs Remote Disk Spill, Warehouse sizing rules, Query Profile analysis, and Search Optimization Service (SOS).
[!NOTE] Snowflake's Query Profile reveals the exact bottlenecks of every execution step. Diagnosing and eliminating Disk Spill is the single fastest way to accelerate slow warehouse queries.
ORDER BY.AUTO_SUSPEND, Remote Spill Audits & Resource MonitorsAUTO_SUSPEND = 1 on a busy BI warehouse receiving queries every 45 seconds (you pay 60s minimum repeatedly!), nor AUTO_SUSPEND = 3600 on a sporadic ETL warehouse. Rule of thumb: AUTO_SUSPEND = 60 (ETL), 120–300 (BI to preserve SSD Cache!), with AUTO_RESUME = TRUE.BYTES_SPILLED_TO_REMOTE_STORAGE): Query SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY for BYTES_SPILLED_TO_REMOTE_STORAGE > 0. Local SSD spill slows queries slightly; Remote Cloud Storage Spill destroys latency 5x–15x and means either the query needs pruning/pre-aggregation or a 1-step larger warehouse (M -> L) for that ETL task.NOTIFY AT 75%, SUSPEND AT 100%) plus STATEMENT_TIMEOUT_IN_SECONDS = 1800 on dev/analyst roles so a forgotten Cartesian join cannot burn weekend budgets.Review the production code, company interview Q&As, incident traces, and comprehension quiz inside this lesson.
-- Query Account Usage to detect queries suffering from Remote Disk Spill
SELECT
query_id,
warehouse_name,
warehouse_size,
execution_time / 1000 AS execution_sec,
bytes_spilled_to_local_storage / (1024*1024*1024) AS local_spill_gb,
bytes_spilled_to_remote_storage / (1024*1024*1024) AS remote_spill_gb
FROM snowflake.account_usage.query_history
WHERE start_time >= DATEADD(day, -7, CURRENT_TIMESTAMP())
AND bytes_spilled_to_remote_storage > 0
ORDER BY bytes_spilled_to_remote_storage DESC
LIMIT 20;SQL compilation error: Statement reached its execution timeout of 28,800 seconds and was cancelled.