Skip to content

Commit efd02bd

Browse files
committed
BrentOzarULTD#1138 sp_BlitzIndex correcting number of NCLs on blocked indexes
Was only counting the number of indexes with lock waits. Closes BrentOzarULTD#1138.
1 parent 5b05d1d commit efd02bd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sp_BlitzIndex.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2148,7 +2148,7 @@ BEGIN;
21482148
N'http://BrentOzar.com/go/AggressiveIndexes' AS URL,
21492149
i.db_schema_object_indexid + N': ' +
21502150
sz.index_lock_wait_summary + N' NC indexes on table: ' +
2151-
CAST(SUM(CASE WHEN index_id NOT IN (0,1) THEN 1 ELSE 0 END)
2151+
CAST(COALESCE((SELECT SUM(1) FROM #IndexSanity iMe INNER JOIN #IndexSanity iOthers ON iMe.database_id = iOthers.database_id AND iMe.object_id = iOthers.object_id AND iOthers.index_id > 1 WHERE i.index_sanity_id = iMe.index_sanity_id),0)
21522152
AS NVARCHAR(30)) AS details,
21532153
i.index_definition,
21542154
i.secret_columns,
@@ -2173,7 +2173,7 @@ BEGIN;
21732173
N'http://BrentOzar.com/go/AggressiveIndexes' AS URL,
21742174
i.db_schema_object_indexid + N': ' +
21752175
sz.index_lock_wait_summary + N' NC indexes on table: ' +
2176-
CAST(SUM(CASE WHEN index_id NOT IN (0,1) THEN 1 ELSE 0 END)
2176+
CAST(COALESCE((SELECT SUM(1) FROM #IndexSanity iMe INNER JOIN #IndexSanity iOthers ON iMe.database_id = iOthers.database_id AND iMe.object_id = iOthers.object_id AND iOthers.index_id > 1 WHERE i.index_sanity_id = iMe.index_sanity_id),0)
21772177
AS NVARCHAR(30)) AS details,
21782178
i.index_definition,
21792179
i.secret_columns,

0 commit comments

Comments
 (0)