Skip to content

Commit 29f11bc

Browse files
authored
Added check for 'Query Store Unusually Configured'
1 parent 1af3788 commit 29f11bc

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

sp_Blitz.sql

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6861,6 +6861,41 @@ IF @ProductVersionMajor >= 10
68616861
AND desired_state <> actual_state
68626862
OPTION (RECOMPILE)';
68636863
END;
6864+
6865+
IF NOT EXISTS ( SELECT 1
6866+
FROM #SkipChecks
6867+
WHERE DatabaseName IS NULL AND CheckID = 265 )
6868+
AND EXISTS(SELECT * FROM sys.all_objects WHERE name = 'database_query_store_options')
6869+
BEGIN
6870+
IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 265) WITH NOWAIT;
6871+
6872+
EXEC dbo.sp_MSforeachdb 'USE [?];
6873+
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
6874+
INSERT INTO #BlitzResults
6875+
(CheckID,
6876+
DatabaseName,
6877+
Priority,
6878+
FindingsGroup,
6879+
Finding,
6880+
URL,
6881+
Details)
6882+
SELECT TOP 1 265,
6883+
N''?'',
6884+
200,
6885+
''Performance'',
6886+
''Query Store Unusually Configured'',
6887+
''https://www.sqlskills.com/blogs/erin/query-store-best-practices/'',
6888+
(''The '' + query_capture_mode_desc + '' query capture mode '' +
6889+
CASE query_capture_mode_desc
6890+
WHEN ''ALL'' THEN ''captures more data than you will probably use. If your workload is heavily ad-hoc, then it can also cause Query Store to capture so much that it turns itself off.''
6891+
WHEN ''NONE'' THEN ''stops Query Store capturing data for new queries.''
6892+
WHEN ''CUSTOM'' THEN ''suggests that somebody has gone out of their way to only capture exactly what they want.''
6893+
ELSE ''is not documented.'' END)
6894+
FROM [?].sys.database_query_store_options
6895+
WHERE desired_state <> 0 /* No point in checking this if Query Store is off. */
6896+
AND query_capture_mode_desc <> ''AUTO''
6897+
OPTION (RECOMPILE)';
6898+
END;
68646899

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

0 commit comments

Comments
 (0)