-3

When we delete huge amounts data from a table, what should be the best thing to follow: Shrink the file group first and rebuild indexes, or Rebuild indexes then shrink the file group?

mustaccio
  • 28,207
  • 24
  • 60
  • 76

1 Answers1

4

Shrink then rebuild. Because

  1. Shrink introduces fragmentation that rebuild removes. And

  2. Shrink doesn't leave the right amount of free space in the files, but the amount of new space required by the rebuild is a reasonable buffer to minimize file growth during normal operations.

David Browne - Microsoft
  • 49,000
  • 3
  • 53
  • 102