Created
May 1, 2018 01:17
-
-
Save jeremybeavon/d5eb5bee3ccfb24399722aed47789b79 to your computer and use it in GitHub Desktop.
Find the usages of all indexes in a database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select OBJECT_NAME(ius.object_id) as "Object Name", | |
i.name as "Index Name", | |
user_seeks, | |
user_scans, | |
user_lookups, | |
user_updates | |
from sys.dm_db_index_usage_stats as ius | |
inner join sys.indexes as i on i.object_id = ius.object_id | |
and i.index_id = ius.index_id | |
where OBJECTPROPERTY(ius.object_id,'IsUserTable') = 1 | |
and ius.database_id = db_id() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment