index rebuild vs index reorg

hi,

what are differences between index rebuild vs index reorg while getting statistics

when to use which one. Advantages, disadvantages of each

please advise.
LVL 7
gudii9Asked:
Who is Participating?
 
Ganesh GuruduSenior ConsultantCommented:
You can find many definitions/differences in google.
Here is simple and straight forward difference.

Index Rebuilding process will drops the existing Index and Recreate the index from the scratch.
Syntax : ALTER INDEX ALL ON Name_of_the_table REBUILD;

Index Reorganizes will physically re-organizes the leaf/branch nodes of the index.
ALTER INDEX ALL ON Name_of_the_table REORGANIZE;

Indexes should be rebuild when the index has fragmentation more than the 40% or so. and the Index reorganized is used when index fragmentation is between 10% to 40%.

Fragmentation happens when we have many delete operations in table. when we delete the record from table, it delete the datablock from and there will be gaps between each datablock . and the logical and physical order of an index does not match in the data file. and fragmentation will also affect the performance of some SQL queries.
1
 
SysToolsData Expert - Recovery,Backup,MigrationCommented:
Index Rebuild & Index Reorganize are two different operations which are used to reduce fragmentation. Both work differently towards the same end.
Index Rebuild recreates the index by dropping existing index while Index Reorganize, physically reorganizes the leaf nodes of the index.
Go through the following link for further information:
http://www.sqlmvp.org/how-to-rebuild-and-reorganize-index-in-sql-server/
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.