Method for querying the last Rebuild time of SQL Server Index, sqlrebuild
A friend has a Job that usually stops executing a Rebuild Index and asked me if I can check which indexes have been rebuilt. We thought that Sys. index or Sys. objects would store similar information and the result was not found.
I checked from the Internet that SQL Server does not store similar information. However, because Rebuild Index automatically updates the statistics, the update time of the statistics is available. Therefore, we can estimate the time based on the statistical information.
Because the update of statistical information may also be an update that reaches the updated threshold value, it is not very accurate.
The specific script is as follows:
SELECT OBJECT_NAME (object_id) [TableName], name [IndexName], STATS_DATE (object_id, stats_id) [LastStatsUpdate] FROM sys. statsWHERE name not like '_ WA %' -- AND STATS_DATE (object_id, stats_id) is not nulland objectproperty (object_id, 'ismsshipped ') = 0 -- Query user-defined order by TableName, indexName ----- code from: http://stackoverflow.com/questions/2831293/tsql-know-when-index-rebuild-reorg-or-updatestatistics-was-last-run-on-sql-ser
You can add filter conditions based on your own.