July 16, 2008 at 6:00 am
ive ran a query to see all indexes associated with an object
select * from sys.indexes(nolock)
where object_id in
(
Object_id
)
for one table in particular, there are 5 indexes returned by the above query ( 1 clustered and 4 non clustered), but in the sys.dm_db_index_usage_stats there are only two rows returned for indexes on this table.
why are there not 5 rows returned for the object from sys.dm_db_index_usage_stats?
July 16, 2008 at 6:25 am
Can you tell which of the indexes (which index_id) are missing?
July 16, 2008 at 6:29 am
winston Smith (7/16/2008)
ive ran a query to see all indexes associated with an objectselect * from sys.indexes(nolock)
where object_id in
(
Object_id
)
for one table in particular, there are 5 indexes returned by the above query ( 1 clustered and 4 non clustered), but in the sys.dm_db_index_usage_stats there are only two rows returned for indexes on this table.
why are there not 5 rows returned for the object from sys.dm_db_index_usage_stats?
The sys.dm_db_index_usage_stats includes indexes that are actually used. If an index is not used, it will not have an entry here. You can write a few queries that would use a particular index, and then have a look at this dynamic management view.
- Andras
July 16, 2008 at 6:55 am
absolutely correct Andreas. I can see now there are a number of tables with indexes that are not regularly used ( although the server wsa rebooted only 3 days ago so they may be used in weekly reports or something.
thanks for the help.
July 16, 2008 at 8:28 am
Also sysindxes shows statistics, while sys.dm_db_index_usage_stats won't.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply