Reputation: 41
I had H2 database of approximately 500MB.
The version of H2 is 1.2.147.
The storage engine of the database is PageStore.
The JDBC URLs are as follows.
jdbc:h2:file://C:/H2/client;IFEXISTS=TRUE;MVCC=TRUE;DATABASE_EVENT_LISTENER='dummy.H2DBMonitor';AUTO_SERVER=TRUE;LOG=2
I made a version of H2 1.4.192 without changing the storage engine of the database.
When my customer used a database, the problem that the file size of the database expanded to up to 80GB occurred.
The database file should become small when I close a connection, but the size of my database file does not become small and may grow big.
It is a phenomenon not to occur in 1.2.147.
Is this problem a bug of the H2 database?
In addition, I get the following errors from trace.db.
pageStore: Transaction log could not be truncated; size: 462MB
Is the error related to this problem?
Upvotes: 4
Views: 1851
Reputation: 21
I had the same issue. I add the following statement to the jdbc url.
DEFRAG_ALWAYS=TRUE
2 GB file becomes 300MB. It is defragmented when the db is closed.
Upvotes: 1
Reputation: 61
I had a similar issue with 5.2GB database file. I executed the following command in the H2 Console:
shutdown compact
and now i have a 300MB file. Maybe it can help you.
For more detailed steps: https://stambia.org/kb/17-runtime-issues/147-the-h2-log-database-s-file-won-t-reduce-after-a-session-purge
Upvotes: 1