Shrink database after drop table?

Dropping a table will free up the space within the database, but will not release the space back to Windows. That requires shrinking the database file. However we don't want the database file full. We want lots of free space so that as we load more data we don't have to grow the data file frequently. This causes fragmentation of the data file on the physical disks.

As for making shrinking faster, no there's no way to make it faster. Shrinking the database requires reading and rewriting most of the data within the database so that all the white space can be released from the database file back to the OS. All this IO takes time, and causes a lot of fragmentation problems.


You'll want to read about DBCC SHRINKFILE very carefully.

http://technet.microsoft.com/en-us/library/ms189493.aspx

In general, you don't want to shrink your database to the smallest possible size on disk. You want to leave SQL Server with plenty of space so that it doesn't have to auto grow much. The answer here has a lot of useful info:

https://stackoverflow.com/questions/4522719/to-dbcc-shrinkdatabase-or-not-to-dbcc-shrinkdatabase-thats-the-question