Skip to main content

Find Unused Indexes

SELECT objects.name AS Table_name,
indexes.name AS Index_name,
indexes.type_desc AS Index_type,
dm_db_index_usage_stats.user_seeks,
dm_db_index_usage_stats.user_scans,
dm_db_index_usage_stats.user_lookups,
dm_db_index_usage_stats.user_updates
FROM sys.dm_db_index_usage_stats
INNER JOIN sys.objects ON dm_db_index_usage_stats.OBJECT_ID = objects.OBJECT_ID
INNER JOIN sys.indexes ON indexes.index_id = dm_db_index_usage_stats.index_id AND dm_db_index_usage_stats.OBJECT_ID = indexes.OBJECT_ID
WHERE dm_db_index_usage_stats.user_lookups = 0 AND
dm_db_index_usage_stats.user_seeks = 0 AND
dm_db_index_usage_stats.user_scans = 0
ORDER BY dm_db_index_usage_stats.user_updates DESC