Skip to content

Instantly share code, notes, and snippets.

@FilipDeVos
Created November 7, 2012 13:34
Show Gist options
  • Save FilipDeVos/4031607 to your computer and use it in GitHub Desktop.
Save FilipDeVos/4031607 to your computer and use it in GitHub Desktop.
Index Usage Statistics of the current database.
select OBJECT_NAME(iu.object_id) as table_name
, i.name
, iu.user_seeks
, iu.user_scans
, iu.user_lookups
, iu.user_updates
, iu.last_user_seek
, iu.last_user_scan
, iu.last_user_lookup
, iu.last_user_update
, i.type_desc
from sys.dm_db_index_usage_stats iu
join sys.indexes i
on iu.object_id = i.object_id
and iu.index_id = i.index_id
where database_id = DB_ID()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment