Skip to content

Commit 58bb740

Browse files
committed
2398 take two
Fixing truncation warnings in sp_BlitzCache and making the single-use plan warning have a dynamic threshold. Closes #2398 with a bang.
1 parent e142368 commit 58bb740

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

sp_BlitzCache.sql

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6141,16 +6141,17 @@ BEGIN
61416141
INSERT INTO ##BlitzCacheResults (SPID, CheckID, Priority, FindingsGroup, Finding, URL, Details)
61426142
SELECT spid,
61436143
999,
6144-
254,
6144+
CASE WHEN ISNULL(p.percent_single, 0) > 75 THEN 1 ELSE 254 END AS Priority,
61456145
'Plan Cache Information',
6146+
CASE WHEN ISNULL(p.percent_single, 0) > 75 THEN 'Many Single-Use Plans' ELSE 'Single-Use Plans' END AS Finding,
6147+
'https://www.brentozar.com/blitz/single-use-plans-procedure-cache/',
61466148
'You have ' + CONVERT(NVARCHAR(10), p.total_plans)
6147-
+ ' in your cache, and '
6149+
+ ' plans in your cache, and '
61486150
+ CONVERT(NVARCHAR(10), p.percent_single)
61496151
+ '% are single use plans'
61506152
+ ', meaning SQL Server thinks it''s seeing a lot of "new" queries and creating plans for them.'
6151-
+ ' Forced Parameterization and Optimize For Ad Hoc Workloads may fix the issue.',
6152-
'https://www.brentozar.com/blitz/single-use-plans-procedure-cache/',
6153-
'To find troublemakers, use: EXEC sp_BlitzCache @SortOrder = ''recent compilations''; '
6153+
+ ' Forced Parameterization and/or Optimize For Ad Hoc Workloads may fix the issue.'
6154+
+ 'To find troublemakers, use: EXEC sp_BlitzCache @SortOrder = ''query hash''; '
61546155
FROM #plan_usage AS p ;
61556156

61566157
IF @is_tokenstore_big = 1

0 commit comments

Comments
 (0)