December 2017
Intermediate to advanced
434 pages
10h 14m
English
As described in the previous section, fragmentation causes more data handling and it can lead to degradation of the performance. When fragmentation occurs heavily (typically on more indexed tables with big data contention), we need to rebuild entire index(es) on such tables. When comparing REBUILD with REORGANIZE, we have to consider more effort needed for index rebuild. When SQL Server is not the Enterprise edition, exclusive table locks are issued when rebuilding an index.
The statement executed internally by the Rebuild index task is as follows:
ALTER INDEX index_name ON table_name WITH REBUILD
Rebuilding is also possible on heaps. Then the statement looks like this:
ALTER TABLE some_table_without_clustered_index WITH REBUILD ...
Read now
Unlock full access