Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
there are statistics on the use of each index, including the clustered one.
this query must be executed in the context of each database. But this won't work for heap tables without indexes.
SELECT
OBJECT_NAME(i.object_id) AS [Table Name]
, i.name AS [Index Name]
, i.is_disabled
, s.last_user_update AS [Last Update Time]
, s.user_updates AS [Updates]
, user_scans
, user_seeks
, user_lookups
, last_user_scan
, last_user_seek
, last_user_lookup
FROM sys.dm_db_index_usage_stats AS s
JOIN sys.indexes AS i ON i.object_id = s.object_id AND i.index_id = s.index_id
JOIN sys.objects AS o ON o.object_id = s.object_id
WHERE s.database_id = DB_ID()
AND OBJECTPROPERTY(i.[object_id], 'IsSystemTable' ) = 0
AND INDEXPROPERTY (i.[object_id], i.name, 'IsAutoStatistics') = 0
AND INDEXPROPERTY (i.[object_id], i.name, 'IsHypothetical' ) = 0
AND INDEXPROPERTY (i.[object_id], i.name, 'IsStatistics' ) = 0
AND INDEXPROPERTY (i.[object_id], i.name, 'IsFulltextKey' ) = 0
AND o.type <> 'IT'
AND i.object_id = object_id('TABLE_NAME')
ORDER BY OBJECT_NAME(i.object_id)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question