Wednesday, June 11, 2014

What is the Difference Between Rebuild and Reorganize indexes ?


Rebuilding Index:-

  • Rebuilding task dropping existing one and create new one.
  • Locking’s and blockings will occurred, during the rebuilding process.
  • Generally rebuild process runs faster than Reorganizing index.
  • More Disk space is required for rebuilding operation.
  • Index and columns stats are automatically updated, as a part of rebuilding process.
  • When the fragmentation is more than 30% better rebuild index.
  • We can rebuild online or offline
  • Example:-

ALTER INDEX (indexname) ON (tablename)
REBUILD;


Reorganizing Index:-
  • Reorganizing task is just modifying the existing index.
  • User can access database during the reorganizing process.
  • Generally reorganizing index takes long time rather than rebuilding task.
  • Less space is required.
  • Index and statics need to be updated after reorganizing index
  • If the fragmentation is B/W 5% to 30% better to Reorganizing Index.
  • Reorganizing index process is offline only.
  • Example
ALTER INDEX (indexname) ON (tablename) REORGANIZE;




No comments:

Post a Comment