Friday, 29 June 2007

Analyze Frequently Used Indexes

The following query will display how frequently a table or index in the current database has been accessed, and by which method.

-- Analyze Index Usage
SELECT OBJECT_NAME(OBJECT_ID),
index_id,
user_seeks,
user_scans,
user_lookups
FROM sys.dm_db_index_usage_stats
ORDER BY user_seeks, user_scans DESC