Skip to content

Commit 094250d

Browse files
BrentOzarclaude
andcommitted
sp_BlitzCache: scope NumberOfPlans UPDATE to current SPID
##BlitzCacheProcs is a global temp table; with concurrent sp_BlitzCache runs it can hold rows for multiple SPIDs. The UPDATE that sets NumberOfPlans / NumberOfDistinctPlans didn't have a SPID predicate, so it would touch other sessions' rows too (and cause unnecessary blocking). Add the standard @@spid filter, matching the two UPDATEs immediately above it at lines 3041 and 3107. Addresses review feedback on BrentOzarULTD#3940. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ffb813b commit 094250d

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

sp_BlitzCache.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3181,6 +3181,7 @@ FROM
31813181
) AS x
31823182
WHERE ##BlitzCacheProcs.QueryHash = x.QueryHash
31833183
AND ##BlitzCacheProcs.DatabaseName = x.DatabaseName
3184+
AND ##BlitzCacheProcs.SPID = @@SPID
31843185
OPTION (RECOMPILE) ;
31853186

31863187
-- query level checks

0 commit comments

Comments
 (0)