Reindexing & defragmentation

  • Hi all,

    Here on daily basis large number of updates/inserts/fetching are happening on database.

    On weekly basis I am reindexing & after that defragmenting my data to improve performance.

    Is it necessary/good to do defragmentation after reindexing.

    If yes then I just have to ask, what i have to do first Reindexing & defragmentation or defragmentation & reindexing or it doesnt matter what is the sequence.

    If No, plz tell me difference in defragmentation & reindexing.

    Plz reply soon..

    Regards

    Majid

  • How are you reindexing? There is reindexing and rebuilding, which operate differently. Read the BOL entries and you'll see that one handles fragmentation.

    How do you defragment? You rebuild the index.

  • For rebuilding indexing I used DBCC DBREINDEX and for defragmentation DBCC INDEXDEFRAG

    Is it necessary to use both commands or just using DBCC DBREINDEX i can do reindexing as well as defragmentation.

  • Reindex completely rebuilds the index, removing fragmentation at all levels.

    Index Defrag shuffles the leaf pages into order, removing fragmentation at the leaf levels, but potentially leaving fragmentation at the other levels of the index.

    Doing a defrag right after a reindex is redundant and a waste of time and server resources.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • If dbcc dbreindex rebuilds indexes also defragment the data then is it necessary to use DBCC INDEXDEFRAG ?

    If I am using DBCC INDEXDEFRAG & after that dbcc dbreindex then is it ok?

    plz reply...

    Regards

    Majid

  • Doing a reindex right after a defrag is redundant and a waste of time and server resources

    A reindex does all that a defrag does and more.

    You would typically use a defrag is you have only a small window (it's often faster than a reindex) or you need the table accesssible during the defrag. (on SQL 2000, an index rebuild is an offline operation)

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • ok..ok..

    got it..

    I will use DBCC dbreindex once a week..

    Thanks a lot Gail for guidance.

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply