Rebuild index
suggest changeOver 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).
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents