SQL Server 2017 sys.query_store_wait_stats

sys.query_store_wait_stats is new to SQL Server 2017 and requires the query store as the name indicates.
 
Below shows a simple extract of the contained information.

SELECT 
 d.[text]
,CAST(b.query_plan AS xml) AS query_plan
,a.*
FROM sys.query_store_wait_stats a
INNER JOIN sys.query_store_plan b ON a.plan_id = b.plan_id
INNER JOIN sys.dm_exec_query_stats c ON b.query_plan_hash = c.query_plan_hash
CROSS APPLY sys.dm_exec_sql_text(c.[sql_handle]) d

image1

Leave a Reply