question

bernard avatar image
bernard asked

shrink and then rebuild or vice versa

Hi, i need to do a shrink process a one time off, in order to release 120GB which i truncated. What is better to do: first shrink and then rebuild indexes or first rebuild indexes and then shrink (second option will give me more free sapce after shrink but messes the indexes again) thanks
shrink-databaserebuild
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
sp_lock avatar image
sp_lock answered
Before you go ahead ask yourself (1) do you need to 120GB back and (2) will you need that space in the next 6-12 months? If any of these are true, then I personally would not perform the shrink. However, to answer your question: The Shrink operation can be the cause of fragmentation therefore you will need to perform the index maintenance AFTER. In his [blog post][1] Paul advises to REORGANIZE instead of rebuilding the whole index to reduce the amount of space needed during the maintenance. [1]: http://www.sqlskills.com/blogs/paul/why-you-should-not-shrink-your-data-files/
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.