reorganise data in data pages on sql server 2000

  • Hello,

    I know that to rebuild indexes we use DBCC DBREINDEX or DBCC INDEXDEFRAG, but how do we defrag data pages? Is there only OS level disk defrag for this purpose?

     

    Thanks

     

  • If a table has a clustered index (which most should as a best practice) then DBCC DBREINDEX or DBCC INDEXDEFRAG rebuilds the table completely (use index id = 1 for dbcc indexdefrag).  This is because the clustered index is considered to "be" the table.

    If the table does not have a clustered index, rows are added to the end of the table and there is no concept of ordering in the table, so there is no "need" to defrag.

    Both of these commands are different from a physical disk-level defrag by windows defrag or Diskeeper-type tools.

     

    Hope this helps,

    Scott Thornburg

  • thanks.

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

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