Rebuild index

suggest change

Over time, B-tree indexes can become fragmented because of inserts, updates, and deletes. In SQL Server terms, fragmentation is internal (a page is partly empty) or external (logical page order does not match physical order). Rebuilding an index is similar to dropping and recreating it.

ALTER INDEX index_name ON table_name REBUILD;

ON table_name is required in SQL Server. Oracle uses ALTER INDEX index_name REBUILD without a table name. By default, a rebuild is an offline operation that locks the table and blocks DML, but many systems allow an online rebuild. Alternatives include REORGANIZE (SQL Server) and COALESCE or SHRINK SPACE (Oracle).

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents