Database never reduce its file size until the connection is shut down in 2.1.214. Version 1.4.200 does.

Skip to first unread message

Pierre-Olivier Lecomte

Jul 27, 2023, 2:56:16 AM7/27/23
to H2 Database

We faced a situation with H2 V2.1.214 where the database file size never goes down until all connections are closed (considering a H2 database using file system and that the actual quantity of data within the database  is stable in time)

This can be a problem for long running databases that are never disconnected, since database file size grow forever until it hits file system limitations.

With a simple test case where we add and delete the same line over and over again in a simple database, we were able to highlight a difference of behavior in the "auto compaction" process between version 1.4.200 & version 2.1.214

The observation is that, under the same circumstances, H2 V1.4.200 reduces the database file size at some point where H2 V2.1.214 never does so until all connections are closed.

Details of the test case & result can be found in the related github link :

Is this an expected change of behavior?

For long running databases in version 2.1.214 ido you have any advice to ensure that the database file size stays stable on the long term and gets compacted from time to time when the database remains open, as it used to happen in 1.4.200?

Best regards
Reply all
Reply to author
0 new messages