Solved

Rebuild and Reorganize Index

Posted on 2013-05-13
8
580 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 

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
 

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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

685 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