Most Snowflake slowness comes from three causes: spilling to local or remote storage, poor partition pruning, and warehouse queueing. You can see all three in SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY.
SELECT query_id, warehouse_name, user_name,
total_elapsed_time/1000 AS seconds,
bytes_spilled_to_local_storage, bytes_spilled_to_remote_storage,
partitions_scanned, partitions_total
FROM snowflake.account_usage.query_history
WHERE start_time > DATEADD(day,-7,CURRENT_TIMESTAMP())
AND execution_status='SUCCESS'
ORDER BY total_elapsed_time DESC LIMIT 25;
Group by query_parameterized_hash to find one query pattern that runs thousands of times. Fixing it once pays off on every run.
Snowflake Query Performance Tuning Kit ($29): 10 SQL scripts to find spilling, pruning failures, queueing and slow queries.
Snowflake Cost + Security Audit Bundle ($79): All 21 cost and security scripts together.
Published by Thyne Ventures. Snowflake is a trademark of Snowflake Inc.; we are not affiliated.