The database size should be regularly checked and optimized. This is particularly important if you use an SQL Server Express LocalDBdatabase, whose physical size limit is 10 GB (10,240 MB).
The fact that records are modified or deleted does not mean that the allocated disk space is automatically released and becomes immediately available for use. The database must periodically be compacted to avoid an excessive waste of disk space. Compaction reduces the size of the database without removing any data; only unused space is reclaimed.
The SQL statement used is: DBCC SHRINKDATABASE for both SQL Server Express LocalDB and SQL Server databases. For more information about this mechanism, see Using Promodag Reports and Microsoft SQL Server.
Use the Compact Database option to compact the database.
For more information about purging unwanted data, see Purge Message Tracking Data and Purge IIS Data.
See also: