Skip to content

Commit a7ef1d9

Browse files
authored
Added check for Query Store Wait Stats
1 parent f16ba9c commit a7ef1d9

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

sp_Blitz.sql

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6758,6 +6758,37 @@ IF @ProductVersionMajor >= 10
67586758
AND N''?'' NOT IN (''master'', ''model'', ''msdb'', ''tempdb'', ''DWConfiguration'', ''DWDiagnostics'', ''DWQueue'', ''ReportServer'', ''ReportServerTempDB'') OPTION (RECOMPILE)';
67596759
END;
67606760

6761+
IF NOT EXISTS ( SELECT 1
6762+
FROM #SkipChecks
6763+
WHERE DatabaseName IS NULL AND CheckID = 262 )
6764+
AND EXISTS(SELECT * FROM sys.all_objects WHERE name = 'database_query_store_options')
6765+
AND @ProductVersionMajor > 13 /* The relevant column only exists in 2017+ */
6766+
BEGIN
6767+
6768+
IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 262) WITH NOWAIT;
6769+
6770+
EXEC dbo.sp_MSforeachdb 'USE [?];
6771+
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
6772+
INSERT INTO #BlitzResults
6773+
(CheckID,
6774+
DatabaseName,
6775+
Priority,
6776+
FindingsGroup,
6777+
Finding,
6778+
URL,
6779+
Details)
6780+
SELECT TOP 1 262,
6781+
N''?'',
6782+
200,
6783+
''Performance'',
6784+
''Query Store Wait Stats Disabled'',
6785+
''https://www.sqlskills.com/blogs/erin/query-store-settings/'',
6786+
(''The new SQL Server 2017 Query Store feature for tracking wait stats has not been enabled on this database. It is very useful for tracking wait stats at a query level.'')
6787+
FROM [?].sys.database_query_store_options
6788+
WHERE desired_state <> 0
6789+
AND wait_stats_capture_mode = 0
6790+
OPTION (RECOMPILE)';
6791+
END;
67616792

67626793
IF @ProductVersionMajor = 13 AND @ProductVersionMinor < 2149 --2016 CU1 has the fix in it
67636794
AND NOT EXISTS ( SELECT 1

0 commit comments

Comments
 (0)