Saturday, December 15, 2007

DMV--sys.dm_db_index_usage_stats

Which non-clustered index(es) is/are most frequently used?



ibhect_id: identify a table

index_id --ID of the index. index_id is unique only within the object.
0 = Heap
1 = Clustered index
> 1 = Nonclustered index

use AdventureWorks
go
SELECT object_id,index_id from sys.dm_db_index_usage_stats

WHERE (user_seeks > 0
or user_scans > 0
or user_lookups > 0)
and index_id>1