Skip to content

Commit

Permalink
Merge pull request BrentOzarULTD#3535 from ReeceGoding/Branch-QS
Browse files Browse the repository at this point in the history
sp_Blitz: Add check for Query Store Wait Stats being turned off
  • Loading branch information
BrentOzar authored Jun 20, 2024
2 parents 03b0120 + a7ef1d9 commit bcfea44
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Documentation/sp_Blitz_Checks_by_Priority.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Before adding a new check, make sure to add a Github issue for it first, and hav

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.

CURRENT HIGH CHECKID: 261.
If you want to add a new one, start at 262.
CURRENT HIGH CHECKID: 262.
If you want to add a new one, start at 263.

| Priority | FindingsGroup | Finding | URL | CheckID |
|----------|-----------------------------|---------------------------------------------------------|------------------------------------------------------------------------|----------|
Expand Down Expand Up @@ -247,6 +247,7 @@ If you want to add a new one, start at 262.
| 200 | Performance | Non-Dynamic Memory | https://www.BrentOzar.com/go/memory | 190 |
| 200 | Performance | Old Compatibility Level | https://www.BrentOzar.com/go/compatlevel | 62 |
| 200 | Performance | Query Store Disabled | https://www.BrentOzar.com/go/querystore | 163 |
| 200 | Performance | Query Store Wait Stats Disabled | https://www.sqlskills.com/blogs/erin/query-store-settings/ | 262 |
| 200 | Performance | Snapshot Backups Occurring | https://www.BrentOzar.com/go/snaps | 178 |
| 200 | Performance | User-Created Statistics In Place | https://www.BrentOzar.com/go/userstats | 122 |
| 200 | Performance | SSAS/SSIS/SSRS Installed | https://www.BrentOzar.com/go/services | 224 |
Expand Down
31 changes: 31 additions & 0 deletions sp_Blitz.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6759,6 +6759,37 @@ IF @ProductVersionMajor >= 10
AND N''?'' NOT IN (''master'', ''model'', ''msdb'', ''tempdb'', ''DWConfiguration'', ''DWDiagnostics'', ''DWQueue'', ''ReportServer'', ''ReportServerTempDB'') OPTION (RECOMPILE)';
END;

IF NOT EXISTS ( SELECT 1
FROM #SkipChecks
WHERE DatabaseName IS NULL AND CheckID = 262 )
AND EXISTS(SELECT * FROM sys.all_objects WHERE name = 'database_query_store_options')
AND @ProductVersionMajor > 13 /* The relevant column only exists in 2017+ */
BEGIN

IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 262) WITH NOWAIT;

EXEC dbo.sp_MSforeachdb 'USE [?];
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
INSERT INTO #BlitzResults
(CheckID,
DatabaseName,
Priority,
FindingsGroup,
Finding,
URL,
Details)
SELECT TOP 1 262,
N''?'',
200,
''Performance'',
''Query Store Wait Stats Disabled'',
''https://www.sqlskills.com/blogs/erin/query-store-settings/'',
(''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.'')
FROM [?].sys.database_query_store_options
WHERE desired_state <> 0
AND wait_stats_capture_mode = 0
OPTION (RECOMPILE)';
END;

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

0 comments on commit bcfea44

Please sign in to comment.