Optimize the space of SQL Server databases

In this tutorial I will show how to optimize the space used by databases.

The optimization of the space is done in two stages:

  • On the database: internal data optimization
  • On files: reducing the size of the files on the disk.

It is recommended that you perform these operations after deleting a large amount of data.

Reduce the size of the database

1. Connect to the server with SQL Server Management Studio.

SSMS - Login

2. Right-click on the database to click Tasks 1 / Minimize 2 / Database 3 .

Database options

3. We can see the space that will be released 1 . Click OK 2 to start the optimization.

Start optimization

4. Waiting during the process, once finished, the window will close.


Reduce file size

As for the size of the database, the operation is to do with SSMS.

1. Right-click on the base to click on Tasks 1 / Minimize 2 / Files 3 .

Database options

2. As for the database, we can see the gain. Click OK to reduce the size of the files.

Start optimization