Skip to content

Instantly share code, notes, and snippets.

@PeterLehmann
Created May 11, 2012 13:34
Show Gist options
  • Save PeterLehmann/2659636 to your computer and use it in GitHub Desktop.
Save PeterLehmann/2659636 to your computer and use it in GitHub Desktop.
select
t.name
, i.name
, s.user_seeks
, s.user_scans
, s.user_updates
, s.user_lookups
, s.last_user_seek
, s.last_user_scan
, s.last_user_lookup
, s.last_user_update
from
sys.tables t
inner join sys.indexes i on (i.object_id = t.object_id)
inner join sys.dm_db_index_usage_stats s on (i.object_id = s.object_id and i.index_id = s.index_id and s.database_id = 7 /*trio*/)
where t.type = 'U'
order by t.name, i.index_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment