May 8, 2012 at 8:04 am
When I ran select * from sys.dm_db_index_usage_stats
on a server which contains about 50 Databases, the database_id column value all show up as 6.:crazy:
What could be the reason ?
Any pointers to try and dig into this problem will be appreciated.
May 8, 2012 at 8:08 am
Only the indexes in database 6 have been used since the last time SQL started? All the other databases have autoclose on and hence their entries got flushed out?
That DBV only shows indexes that have been used in some way since the last time the database was started up.
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
May 8, 2012 at 8:34 am
Good Point Gila.
Now if I detach and reattach the DB -- do you think the rows -- in the DMV/DMF sys.dm_db_index_usage_stats will vanish ?
May 8, 2012 at 8:41 am
Yes. The detach closes the database and all rows for that DB from the index usage DMV (and the index operational stats and missing index DMVs) will be cleared.
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
May 8, 2012 at 8:44 am
Actually they do vanish
This is what BOL says
The counters are initialized to empty whenever the SQL Server (MSSQLSERVER) service is started. In addition, whenever a database is detached or is shut down (for example, because AUTO_CLOSE is set to ON), all rows associated with the database are removed.
Thank you -- now that answers quite a bit.
Now to find out when were they last attached/detached from the System Engineers.
May 8, 2012 at 8:48 am
Grizzly Bear (5/8/2012)
Actually they do vanish
Which is what I said....
Now to find out when were they last attached/detached from the System Engineers.
It's not just detached.
Restored, closed (via the autoclose setting), set offline or SQL restarted.
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 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply