SELECT v.name, i.name, ius.*
FROM sys.dm_db_index_usage_stats ius
JOIN sys.views v ON ius.object_id = v.object_id
JOIN sys.indexes i ON ius.object_id = i.object_id
AND ius.index_id = i.index_id
WHERE ius.database_id = db_id()
Need tsql to find index usage on views
Grossnickle, Brenda
160
Reputation points
I have some views that have indexes and i want to get their usage - seeks, scan, lookups - but i cannot find the tsql code.
SQL Server | SQL Server Transact-SQL
Answer accepted by question author
-
Erland Sommarskog 129.6K Reputation points MVP Volunteer Moderator2025-01-15T22:41:25.01+00:00