Basic Performance Tuning in Snowflake
Instruction: Explain some basic strategies for performance tuning in Snowflake.
Updated
Official answer
Measure first with representative queries and concurrency. Separate compilation, queueing and execution, then inspect Query Profile for scanning, join expansion, spill and expensive operators. EXPLAIN is useful for the planned operations but does not replace runtime evidence.
Reduce unnecessary work while preserving meaning: select needed columns, use selective predicates, join on the correct keys and aggregate at the intended grain. Moving a filter across an outer join can change results, so compare outputs after rewriting.
Standard Snowflake tables do not use conventional user-created indexes. Evaluate pruning and, where justified, clustering or supported search optimization. Hybrid tables have different index capabilities; do not apply their tuning model indiscriminately to analytical tables.
Choose warehouse size for execution requirements and multi-cluster capacity for concurrency. Test whether a larger size improves the bottleneck enough to justify credits. Auto-suspend saves idle compute but affects cache warmth and resumption behavior.
Use maintained aggregates or materialized views only when their supported definitions and maintenance costs fit. Approximate aggregates are suitable only when the business accepts their error properties; they are not a drop-in replacement for required exact results.
Compare correctness, p95 latency, queued time, scan/spill and total credits, including maintenance. Fewer scanned bytes can help, but do not translate mechanically into the same percentage reduction in elapsed time or billed cost. Retest after changes in data volume and workload mix.
Query Profile, clustering, hybrid tables, warehouse considerations