I have a h2 database file and the file size has grown to 5GB. I have deleted some of data to reduced the size of the file. But the file size still remains the same even after deleting the half of the records from the database.
I have tried all the below options to reduce the database size but none of them have worked for me.
1. Executed shutdown compact (after closing all the connection).
2. Executed shutdown defrag.
3. Executed checkpoint.
4. Used the property MV_STORE=FALSE along with the database url.
5. Used the property RETENTION_TIME=30000 along with the database url.
MY connection String looks like below :
"jdbc:h2:" + <db file path>;MVCC=TRUE;DEFAULT_LOCK_TIMEOUT=10000;COMPRESS=TRUE;
NOTE :
Can anyone suggest me some work around or fix to reduce my database size
Because data file is not reduced when you eg delete some records from the database. This is due to performance reasons. So h2 will either replace byte block in a file or append new one, but will not remove anything as it would require rewriting whole file.
Either you didn't compact as you think you did, or you did not delete meaningful (amount) data.