Skip to content

Commit bcfea44

Browse files
authored
Merge pull request #3535 from ReeceGoding/Branch-QS
sp_Blitz: Add check for Query Store Wait Stats being turned off
2 parents 03b0120 + a7ef1d9 commit bcfea44

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

Documentation/sp_Blitz_Checks_by_Priority.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Before adding a new check, make sure to add a Github issue for it first, and hav
66

77
If you want to change anything about a check - the priority, finding, URL, or ID - open a Github issue first. The relevant scripts have to be updated too.
88

9-
CURRENT HIGH CHECKID: 261.
10-
If you want to add a new one, start at 262.
9+
CURRENT HIGH CHECKID: 262.
10+
If you want to add a new one, start at 263.
1111

1212
| Priority | FindingsGroup | Finding | URL | CheckID |
1313
|----------|-----------------------------|---------------------------------------------------------|------------------------------------------------------------------------|----------|
@@ -247,6 +247,7 @@ If you want to add a new one, start at 262.
247247
| 200 | Performance | Non-Dynamic Memory | https://www.BrentOzar.com/go/memory | 190 |
248248
| 200 | Performance | Old Compatibility Level | https://www.BrentOzar.com/go/compatlevel | 62 |
249249
| 200 | Performance | Query Store Disabled | https://www.BrentOzar.com/go/querystore | 163 |
250+
| 200 | Performance | Query Store Wait Stats Disabled | https://www.sqlskills.com/blogs/erin/query-store-settings/ | 262 |
250251
| 200 | Performance | Snapshot Backups Occurring | https://www.BrentOzar.com/go/snaps | 178 |
251252
| 200 | Performance | User-Created Statistics In Place | https://www.BrentOzar.com/go/userstats | 122 |
252253
| 200 | Performance | SSAS/SSIS/SSRS Installed | https://www.BrentOzar.com/go/services | 224 |

sp_Blitz.sql

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

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

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

0 commit comments

Comments
 (0)