Data and index fragmentation and how to fix it

  • HI. What is the best method for checking a database's data and index fragmentation? And if fragmentation exists, what are the best methods to remove the fragmentation?

    Juanita

     

  • You can use dbcc showcontig(tablename) to view the fragmentation in the table's clustered index or heap.  to view fragmentation in a specific index, use dbcc showcontig(tablename,indexname).

    There are 4 ways to fix fragmentation...

    1. drop and recreate the index as two steps

    2. (re)create the index with the "drop existing" option to do it in one step

    3. DBCC DBREINDEX

    4. DBCC INDEXDEFRAG

    -Ray Metz

    Redmond, WA

  • Thank you!

Viewing 3 posts - 1 through 2 (of 2 total)

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