Run above query. primary keys and statistics are eliminated.
Usability is a percentage; 'used' against 'modificated'.
Sort this in the way you like (the only thing you have to add).
Run above query. primary keys and statistics are eliminated.
Usability is a percentage; 'used' against 'modificated'.
Sort this in the way you like (the only thing you have to add).
select LEFT(object_name(a.object_id),40) "tabel",
LEFT(b.name,100) "index",
b.keycnt "columns",
b.used/128 "MB",
(a.user_seeks + a.user_scans + a.user_lookups) "used",
user_updates "modificated",
round(convert(float,convert(float,(a.user_seeks + a.user_scans + a.user_lookups)) / convert(float,(user_updates))) * 100,0) "usability"
from sys.dm_db_index_usage_stats a, sysindexes b
where a.database_id = db_id()
and a.index_id > 1
and a.object_id = b.id
and a.index_id = b.indid
and b.name not like 'PK%'
and b.name not like '[_]WA[_]%'
and a.user_updates > 0