Skip to content

Instantly share code, notes, and snippets.

@vvgsrk
Created April 10, 2020 06:27
Show Gist options
  • Save vvgsrk/3cabc098982dca9afaba6ecdc66478f7 to your computer and use it in GitHub Desktop.
Save vvgsrk/3cabc098982dca9afaba6ecdc66478f7 to your computer and use it in GitHub Desktop.
5 Minute Interval Average Load
SELECT DATE_TRUNC('hour', start_time) start_time_trunced_at_hour,
HOUR(start_time) start_time_hour,
MINUTE(start_time) start_time_min,
AVG(avg_running) avg_running,
AVG(avg_queued_load) avg_queued_load,
AVG(avg_queued_provisioning) avg_queued_provisioning,
AVG(avg_blocked) avg_blocked
FROM snowflake.account_usage.warehouse_load_history
WHERE DATE_TRUNC('day', start_time) = '2020-03-26'
AND warehouse_name = 'PUT_YOUR_WAREHOUSE_NAME'
GROUP BY start_time_trunced_at_hour, start_time_hour, start_time_min
ORDER BY start_time_trunced_at_hour, start_time_min ASC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment