Skip to content

Instantly share code, notes, and snippets.

@DataSic
Last active December 18, 2017 22:28
Show Gist options
  • Save DataSic/97bfb8a792409f3885dd54c66fa8fa7e to your computer and use it in GitHub Desktop.
Save DataSic/97bfb8a792409f3885dd54c66fa8fa7e to your computer and use it in GitHub Desktop.
Query Store Wait Stats aggregation
SELECT w.plan_id,
w.runtime_stats_interval_id,
w.execution_type,
w.wait_category,
w.wait_category_desc,
SUM(w.total_query_wait_time_ms) total_query_wait_time_ms,
AVG(w.avg_query_wait_time_ms) avg_query_wait_time_ms,
MIN(w.min_query_wait_time_ms) min_query_wait_time_ms,
MAX(w.max_query_wait_time_ms) max_query_wait_time_ms
FROM sys.query_store_wait_stats w
GROUP BY w.plan_id,
w.runtime_stats_interval_id,
w.execution_type,
w.wait_category,
w.wait_category_desc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment