Got a read only database and the contents of sys.dm_db_index_usage_stats.last_user_update contains today’s date. How’s that possible?

Any attempt to update the index (via any DML statement) updates that index usage statistics as part of the query scan setup/initialization, even before the iterator’s GetRow method is invoked (i.e. before the iterator attempts to actually insert, delete or update a single row.) In the case of a R/O database, it could happen that there are DML statements trying to make any modifications which will eventually fail with exception 3906 “Failed to update database "%.*ls" because the database is read-only.”, but before they fail the index/indexes potentially affected by the DML get their usage stats updated.

Comments (0)

Skip to main content