diff --git a/Documentation/sp_Blitz_Checks_by_Priority.md b/Documentation/sp_Blitz_Checks_by_Priority.md index 0600e82e..f393f71c 100644 --- a/Documentation/sp_Blitz_Checks_by_Priority.md +++ b/Documentation/sp_Blitz_Checks_by_Priority.md @@ -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 | |----------|-----------------------------|---------------------------------------------------------|------------------------------------------------------------------------|----------| @@ -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 | diff --git a/sp_Blitz.sql b/sp_Blitz.sql index 09bbeef8..caea2adb 100644 --- a/sp_Blitz.sql +++ b/sp_Blitz.sql @@ -6758,6 +6758,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