Rebuilding a table

Use reorg rebuild when:

If a table needs to be rebuilt because of a low cluster ratio, it may also need to have its space management settings changed (see “Changing space management settings before using reorg rebuild”).

reorg rebuild uses a table’s current space management settings to rewrite the rows in the table according to the table’s clustered index, if it has one. All indexes on the table are dropped and re-created using the current space management values for reservepagegap and fillfactor. After a rebuild, a table has no forwarded rows and no unused space from deletions or updates.

reorg rebuild syntax

The syntax for reorg rebuild is:

reorg rebuild tablename [index_name]

reorg rebuild performs the following when you run it against a table:

If the table is large and has several indexes, the locks for updating system tables can be held for a long time, and these locks may block other processes from accessing these system tables. However, because systabstats is already datarow locked, this system table does not impact this blocking

reorg rebuild builds the clustered index using the with sorted data option, so the data does not have to be resorted during this index build.