Wednesday 1 October 2008

Reorganize / Rebuild a single index

Reorganizing an index physically reorders the leaf nodes of an index >
ALTER INDEX indexname ON schema.table REORGANIZE


Rebuilding an index drops an index and recreates it >
ALTER INDEX indexname ON schema.table REBUILD

Rebuilding is more resource intensive.

If you're using a version that supports it (Developer/Enterprise), rebuilds can be done ONLINE.
ALTER INDEX indexname ON schema.table REBUILD WITH(ONLINE = ON)

No comments: