SQL Server does not store a single “last index rebuild” date for the whole instance. Each index (and each partition in a partitioned index) keeps its own record of when it was last rebuilt, and you read that record from the dynamic management view sys.dm_db_index_usage_stats joined to sys.indexes. The catch: that DMV resets when SQL Server restarts or a database goes offline, so a clean, recent timestamp can mean “rebuilt last week” or “rebuilt at any point before the service restarted.” The reliable long-term answer for rebuilds you performed through maintenance plans or scripts is your job history or maintenance log, not the DMV.

This article walks through the queries, what the numbers actually mean, the conditions that produce misleading answers, and how to verify a result you don’t trust. Everything below uses documented system objects that have existed for many versions; I can’t check your specific build, so treat version-sensitive notes as things to confirm on your server.

What “last index rebuild” actually refers to in SQL Server

SQL Server tracks index maintenance through a handful of columns, and it helps to separate them because they answer different questions:

Rebuild (ALTER INDEX … REBUILD, the maintenance-plan “Rebuild Index” task): physically drops and recreates the index. sys.indexes row for the index is replaced; the DMV timestamp you’ll query gets a fresh value when the index is next touched. A rebuild of a single index does not touch other indexes. Reorganize (ALTER INDEX … REORGANIZE): an in-place defragmentation. The index object persists. Tracking when a reorganize happened is much harder—more on that below. UPDATE STATISTICS: refreshes optimizer statistics, not the index structure. It doesn’t answer “when was the index last rebuilt,” though people often conflate the two.

The distinction matters because SQL Server’s built-in metadata records the index object’s creation in sys.indexes.create_date, but that column is not a reliable rebuild history. For heaps and clustered indexes, recreating the object can reset it; for nonclustered indexes it may reflect the original creation. More importantly, an index rebuild that uses the same name and columns can leave create_date unchanged or change it in ways that don’t map cleanly to “last rebuilt.” The column people actually rely on for maintenance tracking is last_user_update in sys.dm_db_index_usage_stats.

The primary query: reading last rebuild time from the DMV

The standard query joins sys.indexes to sys.dm_db_index_usage_stats on database, object, and index ID. last_user_update records the last time the index was modified by a user query—inserts, updates, and deletes that touch the index, plus index rebuilds and reorganizes, which register as modifications to the index.

Here is a query you can run against a single database:

Run it in each database you care about, or loop over sys.databases. A few practical notes on interpreting the output:

1: NULL last_user_update does not mean “never rebuilt.” It means the DMV has no modification recorded for that index since the last restart or database attach. A brand-new index that was rebuilt and then only read will also show NULL, because reads don’t update that column. 2: last_user_update is not exclusively rebuilds. An index that receives heavy INSERT/UPDATE/DELETE traffic will show a very recent last_user_update even if it was rebuilt months ago. On write-heavy tables, this column tells you when the index was last written to, full stop. It cannot distinguish a rebuild from ordinary DML. 3: The DMV resets. If your instance restarted Tuesday, every last_user_update is either NULL (index untouched since restart) or Tuesday or later. A timestamp cannot predate the restart. This is the single biggest source of wrong conclusions.

So the DMV query is good for a quick sanity check on a quiet, read-mostly table: if last_user_update is recent and the table has negligible write activity, a rebuild is a plausible explanation. On a busy OLTP table it’s nearly useless as a rebuild record, and you should rely on job history instead.

Reading the same data across every database

To survey the whole instance, build a dynamic-SQL loop over the user databases. This version excludes system databases and handles databases that are offline or in recovery:

The DB_ID(N'database') call inside the generated query is deliberate: sys.dm_db_index_usage_stats is scoped to the current database, so filtering on database_id inside each per-database query keeps the join accurate. Expect the result set to be large; filter by table or schema before you present it to anyone.

If your environment has hundreds of databases, the loop is still fine, but set expectations: the DMV is per-database and rebuilt after restart, so a large survey shows mostly “since last restart” values.

Why the caveats matter more than the query

Three behaviors make the DMV answer unreliable, and they’re worth understanding before you use the timestamp in a report or a ticket.

Restart and reattach resets. sys.dm_db_index_usage_stats is cleared on SQL Server startup and when a database is taken offline, detached, or restored. A restored database starts with no usage stats at all. So the query answers “index modifications since this database was last started,” not “last rebuild ever.”

Reorganize is effectively invisible. Reorganize doesn’t create a new index object, and the DMV has no dedicated “last reorganize” column. last_user_update can move when a reorganize runs on a partitioned index whose pages get moved, but you cannot reliably infer “reorganized on date X” from it. If someone asks when an index was last reorganizes, the honest answer is that SQL Server doesn’t expose it cleanly, and the maintenance log is the only durable record.

Statistics updates are a different animal. If your question is really “is my index maintenance current,” check sys.stats properties too—but know that STATS_DATE() on statistics answers a different question than rebuild time. Queries probing sys.dm_db_index_usage_stats will show recent last_user_update on tables with auto-created stats and heavy writes, which is not a rebuild.

Rebuilds are logged; query history isn’t free. If you rebuild through a maintenance plan, an Agent job running ALTER INDEX statements, or a third-party tool, the SQL Server error log or msdb job history may retain a record. SQL Server does log “Index rebuild” events when the ALTER INDEX executes for the database in the error log (and Extended Events or default trace can capture it on supported versions). The error log rolls over, so a rebuild from six months ago may be gone from the log. Agent job history retention is typically 1,000 rows per job by default—usually enough for a weekly job’s recent weeks, not for a year.

The durable method: maintenance logs and job history

If you need a reliable answer to “when was this index last rebuilt,” the practical method is to record the event yourself. Four approaches, in rough order of effort:

1: Query msdb job history. If rebuilds run through a SQL Server Agent job as a T-SQL step using ALTER INDEX, the job history records step completion time. This is a coarse signal—it tells you the job ran, not necessarily which index succeeded—but it’s durable and survives restarts. Query msdb.dbo.sysjobhistory joined to sysjobs for the maintenance job, filter on run_status = 1, and read run_date/run_time. 2: Log the rebuilds in a tracking table. Wrap your rebuild statements so each successful ALTER INDEX inserts a row into a small audit table with object name, index name, timestamp, and the user or job that ran it. This is the most accurate option and takes maybe an hour to set up once. 3: Use Extended Events. Capture a session on sqlserver.index_rebuild events or the relevant ALTER INDEX error reports, writing to a file or ring buffer. This works well for “what happened recently” but requires you to have started the session before the rebuild—no retroactive capture. 4: Default trace and error log review. Both provide after-the-fact evidence that can confirm a rebuild occurred, but retention windows are short; treat them as corroboration, not the system of record.

For the common question “when was the last full rebuild of the database,” the maintenance plan’s job history is the answer you should quote. The DMV is the answer you should double-check against a restart timestamp.

Checking whether the timestamp is credible

Before you trust a DMV result, run a quick consistency check. Compare the last_user_update value against the SQL Server instance start time, which you can get from sys.dm_os_sys_info:

If the last update is earlier than the start time, something is wrong—that timestamp can’t be real and likely reflects stale or restored metadata; treat it with suspicion. If the last update equals or comes within a few minutes of the start time, the index was probably touched right after restart, or the returned value is simply the restart boundary. And if you see last_user_update values that are identical across many indexes to the second, that pattern is consistent with a single big rebuild job and inconsistent with ordinary DML, which tends to produce scattered timestamps.

A second credibility check is to test what the DMV says about an index you just rebuilt in a controlled way. On a development instance, rebuild a specific index, record the time, then query the DMV for that index: within a minute you should see last_user_update at or just after your rebuild time, and user_updates should increment. If it doesn’t, the DMV is being reset or filtered in a way you didn’t expect.

For the mirrored case—proving a rebuild didn’t happen—absence of evidence is weak. A NULL value after restart proves nothing, and a stale timestamp only proves no writes reached that index, not that no rebuild occurred.

A worked comparison of the methods

Suppose a junior DBA runs the DMV query on an OrderHistory table in the Sales database and reports “index rebuilt five minutes ago.” The table is a write-intensive order-log table. Here’s how the methods sort out that claim:

DMV query: returns last_user_update five minutes ago. user_updates is in the tens of thousands. That’s consistent with ordinary order inserts, and it does not prove a rebuild. One point for “possible, not established.” Agent job history: the nightly “Rebuild Indexes” job last completed at 02:14. No job ran five minutes ago. The DMV claim is not supported by the maintenance schedule. Two points against. Tracking table: no insert in the index rebuild log in the last 30 days. Three points against. Error log: no rebuild event any time near the claimed timestamp. The claim fails.

The correct statement is that the index received heavy user updates five minutes ago; there is no evidence of a rebuild at that time. The lesson: keep the DMV as a first look, not as the record.

On a read-mostly reference table with no write activity, the same DMV query is much more informative—writes only occur during maintenance, so a recent last_user_update would require a maintenance event or an unusual manual write. That’s the narrow case where the quick query is a decent first approximation, and even then a restart check should follow.

Changing an existing answer: keep the scope straight

If your team already has a script that reports the “last rebuild,” audit it for these three errors before relying on its output: it ignores the restart boundary, it treats last_user_update as rebuild-specific, and it omits partitioned indexes where different partitions have different histories. Fixing the first two is a documentation and expectation problem rather than a query rewrite. Fixing the third requires joining on both index_id and partition_number in the usage stats DMV when you filter down to a specific partition—and acknowledging that sys.dm_db_index_usage_stats doesn’t carry per-partition rows for all patterns, so partition history is genuinely harder to reconstruct.

The scope question is the one worth asking up front: “last index rebuild” can mean one index, one table, one database, or the whole instance. The DMV query answers the per-index question, but only since restart. The maintenance log answers the per-job question durably. Neither answers “the last time this exact partition in this exact filegroup was rebuilt” without additional instrumentation. Decide which question you actually need, then pick the method—rather than running the easy query and hoping the timestamp means what it looks like.