Free Space in Database Files

In SQLite, when you delete or update data, the space it occupied in the database file is not immediately reclaimed. Instead, the space is added to the free-list and made available for reuse by new data.

It would be inefficient to return these pages to the operating system only to reassign them later. And in practice, deleting a lot of data doesn't usually happen during normal operation.

In exceptional cases, there may be a reason to reorganize the database file. Sqlite therefore provides the command vacuum

The HTTP API command <db>/rebuild_db executes it.

It is recommended to stop all applications and make a backup before.