Rebuild Index vs Drop and Create Index

  • 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.

  • Drop and recreate should use less log space.

  • 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.

  • 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

  • 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" 😉

  • The index was heavily fragmented so I wanted to compare the rebuild vs the drop and create.

  • 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