Solved

Rebuild and Reorganize Index

Posted on 2013-05-13
8
570 Views
Last Modified: 2013-05-16
In SQL 2008, is it necessary to rebuild and reorganize the index under the maintenance Plans.

If so, which one should rebuild periodically?  Should I Rebuild before Reorganizing?  

What is the main difference between these two tasks?  Are there any dangers to doing this?

I will be using the maintenance wizard to implement this, so any advice on the above questions would be helpful.

Thanks
0
Comment
Question by:al4629740
  • 4
  • 2
  • 2
8 Comments
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 400 total points
ID: 39163154
Yes you should schedule jobs to do that, I wont recommend maiintenance plans though, use the script mentioned here
http://ola.hallengren.com/sql-server-index-and-statistics-maintenance.html

differene b/w reindex and organie can be found here
http://technet.microsoft.com/en-us/library/ms189858(v=sql.105).aspx
0
 

Author Comment

by:al4629740
ID: 39163216
Why not the maintenance plans?
0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 39163227
>Why not the maintenance plans?
You cannot really specify when to go for index reorganise and rebuild. Also i find it really hard to debug. The solution on that link is excellent most of the top SQL gurus uses that.
0
 

Author Comment

by:al4629740
ID: 39163278
Would I run this code without modification?

http://ola.hallengren.com/scripts/IndexOptimize.sql

I am apprehensive about running any scripts that change something that I don't fully understand.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:al4629740
ID: 39163308
Also, in my original question, which would be better to do first?

Reorganize or rebuild?
0
 
LVL 75

Assisted Solution

by:Anthony Perkins
Anthony Perkins earned 100 total points
ID: 39163507
Would I run this code without modification?
All the code does is create a Stored Procedure called IndexOptimize, it is up to you how you want to execute it.

I am apprehensive about running any scripts that change something that I don't fully understand.
And how is that different from a Maintenance Plan?  Do you have any idea what it is doing?

Also, in my original question, which would be better to do first?
Reorganize or rebuild?

It depends.  You use one or the other not both.  Have you read the link that Aneesh posted on the subject?
0
 

Author Comment

by:al4629740
ID: 39163549
ok.  How does one determine the avg_fragmentation_in_percent
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 39164497
How does one determine the avg_fragmentation_in_percent
It is covered in that same article that Aneesh posted.  Let me know if you are having difficulty reaching that link.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now