Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save LetsGoRafting/a27ea9f822d59cd4f4b30dd02a01f318 to your computer and use it in GitHub Desktop.

Select an option

Save LetsGoRafting/a27ea9f822d59cd4f4b30dd02a01f318 to your computer and use it in GitHub Desktop.
last run queries is server being used
Use <DBName>;
Select OBJECT_SCHEMA_NAME(I.object_id) + N'.' + OBJECT_NAME(I.object_id) As TableName,
I.name As IndexName,
I.index_id As IndexID,
IUS.user_seeks,
IUS.user_scans,
IUS.user_lookups,
IUS.user_updates,
IUS.last_user_seek,
IUS.last_user_scan,
IUS.last_user_lookup,
IUS.last_user_update
From sys.indexes As I
Inner Join sys.dm_db_index_usage_stats As IUS
On IUS.object_id = I.object_id
And IUS.index_id = I.index_id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment