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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Databases

From novice to tech pro — start learning today.