You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 61e5506
Browse filesBrowse the repository at this point in the historyBrowse files
CRITICAL:
- Line 2397: max_worker_time used instead of max_elapsed_time for
statement-level queries — showed CPU time as elapsed duration
HIGH (5 AND/OR precedence bugs):
- Line 4883: bitmask & 8192 = 8191 always false — NUMERIC_ROUNDABORT
never detected, fixed to = 8192
- Lines 4904-4906: cursor detection SPID filter bypassed
- Lines 4276-4278: variable JOIN cross-joined adhoc queries
- Lines 4530-4535: missing index check SPID filter bypassed
- Lines 5108-5109: "No warnings" update SPID filter bypassed
MEDIUM:
- Line 2021: OR instead of AND in @DatabaseName null/empty check —
empty string silently returned zero results
- Line 6036: /1000/1000 double division displayed "0 second(s)"
instead of "300 second(s)" for long running query warning
- Lines 6560-6774: 15 findings checks (CheckIDs 54-68) missing
AND SPID = @@spid — concurrent sessions saw each other's data
- Line 6293: CheckID 33 vs 34 mismatch for is_table_variable
- Lines 3061-3065: missing SPID filter on grouped percentage UPDATE
LOW:
- Lines 2622-2631: SUBSTRING debug prints overlapping output
- Line 4338: NCHAR(10) misplaced inside ELSE for QUOTED_IDENTIFIER
- Line 2278: missing divide-by-zero guard on PercentExecutionsByType
- Line 1082: @renalyze typo in error message
- Line 4335: extra leading space in ARITHABORT OFF
Tested all 6 execution modes on sql2022 — all pass.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: sp_BlitzCache.sql
+55-52Lines changed: 55 additions & 52 deletions
Original file line number
Diff line number
Diff line change
@@ -1079,7 +1079,7 @@ IF @Top IS NULL
1079
1079
OR @QueryFilter ISNULL
1080
1080
OR @Reanalyze ISNULL
1081
1081
BEGIN
1082
-
RAISERROR(N'Several parameters (@Top, @SortOrder, @QueryFilter, @renalyze) are required. Do not set them to NULL. Please try again.', 16, 1) WITHNOWAIT;
1082
+
RAISERROR(N'Several parameters (@Top, @SortOrder, @QueryFilter, @Reanalyze) are required. Do not set them to NULL. Please try again.', 16, 1) WITHNOWAIT;
1083
1083
RETURN;
1084
1084
END;
1085
1085
@@ -2018,7 +2018,7 @@ IF @IgnoreSystemDBs = 1
2018
2018
SET @body +=N' AND COALESCE(LOWER(DB_NAME(CAST(xpa.value AS INT))), '''') NOT IN (''master'', ''model'', ''msdb'', ''tempdb'', ''32767'', ''dbmaintenance'', ''dbadmin'', ''dbatools'') AND COALESCE(DB_NAME(CAST(xpa.value AS INT)), '''') NOT IN (SELECT name FROM sys.databases WHERE is_distributor = 1)'+ @nl ;
2019
2019
END;
2020
2020
2021
-
IF @DatabaseName ISNOTNULLOR @DatabaseName <>N''
2021
+
IF @DatabaseName ISNOTNULLAND @DatabaseName <>N''
2022
2022
BEGIN
2023
2023
RAISERROR(N'Filtering database name chosen', 0, 1) WITHNOWAIT;
2024
2024
SET @body +=N' AND CAST(xpa.value AS BIGINT) = DB_ID(N'
@@ -2275,7 +2275,9 @@ BEGIN
2275
2275
CASE WHEN t.t_TotalReads = 0 THEN 0
2276
2276
ELSE CAST(ROUND(100.00 * total_logical_reads / t.t_TotalReads, 2) AS MONEY)
2277
2277
END AS PercentReadsByType,
2278
-
CAST(ROUND(100.00 * execution_count / t.t_TotalExecs, 2) AS MONEY) AS PercentExecutionsByType,
2278
+
CASE WHEN t.t_TotalExecs = 0 THEN 0
2279
+
ELSE CAST(ROUND(100.00 * execution_count / t.t_TotalExecs, 2) AS MONEY)
2280
+
END AS PercentExecutionsByType,
2279
2281
(total_elapsed_time / 1000.0) / execution_count AS AvgDuration ,
2280
2282
(total_elapsed_time / 1000.0) AS TotalDuration ,
2281
2283
total_logical_reads / execution_count AS AvgReads ,
@@ -2394,7 +2396,7 @@ BEGIN
2394
2396
qs.max_worker_time / 1000.0,
2395
2397
CASE WHEN qp.query_plan.value(''declare namespace p="http://schemas.microsoft.com/sqlserver/2004/07/showplan";max(//p:RelOp/@Parallel)'', ''float'') > 0 THEN 1 ELSE 0 END,
0 commit comments