Headline
In one of my projects, I use a h2 database with file storage.
According to h2 db documentation
"The empty space in the database file [used] is reused automatically. When you close the database, the database is automatically compressed to 200 milliseconds by default."
White space is created each time a row is deleted or updated. Unfortunately, the database file is constantly growing during operation.
In this discussion are invited to create a backup copy of the database and restore it again. However, I am looking for a solution for a compact / vacuum database at runtime, without stopping. Is there any way to achieve this?
Of course, this is an option to migrate to a database such as Postgres. However, my project should be very easy to install, so you need to integrate it into the installer. Usually adding a dedicated database adds some overhead.
source
share