Shrinking (compression)
Reclaim unused SQL database space safely with SQL Server Management Studio.
Shrinking (from v7.70+)
If a database is approaching 10 GB on SQL Express and you believe it contains empty space, you can shrink it through SSMS. Empty space comes from deleting or archiving data: when you archive events, the events are replaced with empty space and the database size does not shrink automatically.
To shrink in SSMS, right-click the database and go to Tasks > Shrink > Files.

Shrink both the main Data file (.mdf) and the Log file (.ldf). Note that the operation only shrinks the file by the amount shown in Available free space.

Select Log from the File type: dropdown to shrink the .ldf file.

Press OK on each to perform the operation. Depending on the file size and the space being reclaimed, this can take from seconds to a few minutes. If the available free space is very small (500 MB or less) there is no real reason to perform the operation, though it will still reclaim the amount shown.
🔗 Related
Archiving - An Overview. Archiving is what frees the space you then reclaim.
Databases - Sizes and Examples. How the databases grow.
Last updated
Was this helpful?
