I am using SQL Server 2008 R2 and running the following query to see when the index in my database was last updated using the following SQL:
SELECT last_system_update, last_user_update, OBJECT_NAME(object_id) AS tblName FROM sys.dm_db_index_usage_stats WHERE database_id = DB_ID('mydatabase')
The last_user_update field is valid and contains NULL, in which updates have not been added to the table since the last restart of SQL Server.
When I ran the following query to rebuild the index, I would expect the last_system_update field to contain a date indicating that the index was rebuilt:
ALTER INDEX ALL ON dbo.MyTable REBUILD
However, this field remains NULL. In fact, the last_system_update field is empty (NULL) for all indexes in all databases on the server. last_user_update also does not change.
I also tried:
UPDATE STATISTICS dbo.MyTable
But no luck. So when is this field updated? And how can I make it update?
source share