Skip to content

Commit dd770b9

Browse files
authored
Merge pull request BrentOzarULTD#3931 from BrentOzarULTD/copilot/fix-unindexed-foreign-keys-warning
sp_BlitzIndex: suppress Unindexed Foreign Keys findings for unread tables
2 parents 8691608 + cfc1859 commit dd770b9

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

sp_BlitzIndex.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6017,6 +6017,14 @@ BEGIN
60176017
(SELECT TOP 1 more_info FROM #IndexSanity i WHERE i.object_id=fk.parent_object_id AND i.database_id = fk.database_id AND i.schema_name = fk.schema_name)
60186018
AS more_info
60196019
FROM #UnindexedForeignKeys AS fk
6020+
WHERE EXISTS (
6021+
SELECT 1/0
6022+
FROM #IndexSanity i
6023+
WHERE i.object_id = fk.parent_object_id
6024+
AND i.database_id = fk.database_id
6025+
AND i.schema_name = fk.schema_name
6026+
AND (ISNULL(i.user_seeks, 0) + ISNULL(i.user_scans, 0) + ISNULL(i.user_lookups, 0)) > 0
6027+
)
60206028
OPTION ( RECOMPILE );
60216029

60226030

0 commit comments

Comments
 (0)