Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Rebuild Index vs Drop and Create Index Expand / Collapse
Author
Message
Posted Thursday, July 10, 2008 11:24 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, May 19, 2009 7:03 AM
Points: 7, Visits: 66
Which option uses less log space or writes to the log file the least: 1.rebuild index or 2. dropping an index and then creating it again?

The reason I ask is because I need to rebuild a heavily fragmented index on a SQL 2005 database. We currently have space issues on the drive that the database log file resides on and when we rebuild the index the drive fills up and we are unable to complete the task. At this time, the easy solution of adding more disk space is not an option.
Post #531822
Posted Thursday, July 10, 2008 12:05 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Yesterday @ 8:41 PM
Points: 31,080, Visits: 15,525
Drop and recreate should use less log space.







Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #531853
Posted Thursday, July 10, 2008 3:30 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, May 19, 2009 7:03 AM
Points: 7, Visits: 66
Thanks for the reply Steve.


We have decided to set the Recovery Model of the database to Bulk-logged and then drop and recreate the index. After creating the index we will set the Recovery Model back to Full. The bulk-logged recovery model minimally logs bulk operations, in my case the creation of an index.
Post #532009
Posted Thursday, July 10, 2008 4:21 PM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Tuesday, September 16, 2014 5:47 AM
Points: 6,259, Visits: 2,029
shensarling (7/10/2008)
Thanks for the reply Steve.


We have decided to set the Recovery Model of the database to Bulk-logged and then drop and recreate the index. After creating the index we will set the Recovery Model back to Full. The bulk-logged recovery model minimally logs bulk operations, in my case the creation of an index.

Make sure you take a full backup or at least a log backup "right after" you switch the recovery mode.



* Noel
Post #532034
Posted Friday, July 11, 2008 1:37 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 8:38 AM
Points: 6,416, Visits: 13,797
do you mean reorganise vs drop and create rather than rebuild vs drop and create

-----------------------------------------------------------------------------------------------------------

"Ya can't make an omelette without breaking just a few eggs"
Post #532192
Posted Friday, July 11, 2008 1:27 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, May 19, 2009 7:03 AM
Points: 7, Visits: 66
The index was heavily fragmented so I wanted to compare the rebuild vs the drop and create.

Post #532774
Posted Friday, July 11, 2008 3:54 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 8:38 AM
Points: 6,416, Visits: 13,797
oh OK. There are advantages and disadvantages of both, the following link details rebuild vs drop and create

http://msdn.microsoft.com/en-us/library/ms189858.aspx


-----------------------------------------------------------------------------------------------------------

"Ya can't make an omelette without breaking just a few eggs"
Post #532881
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse