July 10, 2008 at 11:24 am
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.
July 10, 2008 at 12:05 pm
Drop and recreate should use less log space.
July 10, 2008 at 3:30 pm
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.
July 10, 2008 at 4:21 pm
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
July 11, 2008 at 1:37 am
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" 😉
July 11, 2008 at 1:27 pm
The index was heavily fragmented so I wanted to compare the rebuild vs the drop and create.
July 11, 2008 at 3:54 pm
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" 😉
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply