Technologies/Redis/snowflake_query_executed
RedisRedisMetric

snowflake_query_executed

Executed query count for warehouse over the last 24 hour window.
Dimensions:None

Technical Annotations (34)

Configuration Parameters (1)
auto_suspendrecommended: 60 seconds
Snowflake default is 5 minutes; 60 seconds is ideal for most workloads
Error Signatures (3)
version mismatch errorserror code
SQL execution errorserror code
SQL execution internal errorlog pattern
CLI Commands (5)
EXPLAIN PLANdiagnostic
SELECT warehouse_name, user_name, COUNT(query_id) AS query_count, MEDIAN(execution_seconds) AS median_execution_seconds FROM (SELECT warehouse_name, user_name, query_id, execution_time / 1000 AS execution_seconds FROM snowflake.account_usage.query_history WHERE start_time >= DATEADD('day', -30, CURRENT_TIMESTAMP()) AND warehouse_name IS NOT NULL AND execution_status = 'SUCCESS') GROUP BY warehouse_name, user_name ORDER BY query_count DESCdiagnostic
SET warehouse_names = 'COMPUTE_WH, DEV_WH'; SELECT CASE WHEN bytes_scanned / power(1024,3) < 0.1 THEN 1 WHEN bytes_scanned / power(1024,3) < 1 THEN 2 WHEN bytes_scanned / power(1024,3) < 10 THEN 3 WHEN bytes_scanned / power(1024,3) < 20 THEN 4 WHEN bytes_scanned / power(1024,3) < 50 THEN 5 WHEN bytes_scanned / power(1024,3) < 100 THEN 6 WHEN bytes_scanned / power(1024,3) < 200 THEN 7 WHEN bytes_scanned / power(1024,3) < 500 THEN 8 WHEN bytes_scanned / power(1024,3) < 1000 THEN 9 ELSE 10 END as gb_ranking , CASE WHEN bytes_scanned / power(1024,3) < 0.1 THEN '0 to 100MB' WHEN bytes_scanned / power(1024,3) < 1 THEN '100MB to 1GB' WHEN bytes_scanned / power(1024,3) < 10 THEN '1GB to 10GB' WHEN bytes_scanned / power(1024,3) < 20 THEN '10GB to 20GB' WHEN bytes_scanned / power(1024,3) < 50 THEN '20GB to 50GB' WHEN bytes_scanned / power(1024,3) < 100 THEN '50GB to 100GB' WHEN bytes_scanned / power(1024,3) < 200 THEN '100GB to 200GB' WHEN bytes_scanned / power(1024,3) < 500 THEN '200GB to 500GB' WHEN bytes_scanned / power(1024,3) < 1000 THEN '500GB to 1TB' ELSE '1TB+' END as gb_scanned , COUNT(*) as num_queries , AVG(execution_time)*0.001 as avg_execution_time_s , PERCENTILE_DISC(0.95) WITHIN GROUP (ORDER BY execution_time ASC)*0.001 as p95 FROM snowflake.account_usage.query_history AS qh WHERE 1=1 AND qh.warehouse_name IN (SELECT TRIM(VALUE) FROM TABLE(SPLIT_TO_TABLE($warehouse_names, ','))) AND qh.warehouse_size IS NOT NULL AND qh.start_time >= current_date - 90 AND qh.query_type = 'SELECT' GROUP BY 1,2 ORDER BY 1 ASC;diagnostic
SELECT query_id, query_text, execution_time, total_elapsed_time, bytes_scanned FROM snowflake.account_usage.query_history WHERE start_time > DATEADD(day, -7, CURRENT_DATE()) ORDER BY execution_time DESC;diagnostic
EXPLAIN SELECT * FROM my_table WHERE column1 = 'value1';diagnostic
Technical References (25)
Query ProfilecomponentQUERY_HISTORYcomponentACCOUNT_USAGEcomponentdatabase schemaconceptrelease packagescomponentSnowflake Data CloudcomponentSnowpipecomponentSnowpipe Streamingcomponentdata clusteringcomponentclustered columnscomponentmaterialized viewscomponentquery profilescomponentBI dashboardconceptrefresh frequencyconceptquery_historycomponentaccount_usagecomponentauto-suspendcomponentbilling minimumconceptbytes_scannedconceptsnowflake.account_usage.query_historycomponentEXPLAINcommandcompute creditsconceptwarehousecomponentWAREHOUSE_METERING_HISTORYcomponentCOST_PER_QUERYconcept
Related Insights (13)
Queries consuming excessive resources or execution timewarning
Backwards-incompatible database schema update causes version mismatch and operation failurescritical
Customer queries return SQL execution errors during schema incompatibilitycritical
Incompatible database schema update causes query failures and service outagecritical
Backwards-incompatible schema update causes multi-region outagecritical
Inefficient queries with unnecessary table scans and missing filterswarning
High-frequency dashboard refreshes accumulate disproportionate compute costswarning
Query history analysis enables cost-effective workload routinginfo
60-second billing minimum creates idle time waste on short querieswarning
Majority of queries scan under 100 GB indicating engine mismatchinfo
Slow-running queries degrading Snowflake performancewarning
Unbounded processing causes exponential compute cost overrunscritical
Warehouse credit consumption disproportionate to query countwarning