Debugging large database file

25 views
Skip to first unread message

Quy Nguyen

unread,
Feb 11, 2021, 1:42:12 PM2/11/21
to H2 Database
Hello,

I have an issue with the size of the database file. It stores roughly 500mb of data normally, but during use it can balloon to something like 25GB. If I restart the application, it can spends hours reading and writing the database, and then the file will be back to 500mb.

I'm using the following dependencies, along with Ktorm as my ORM, but I did not have this issue when I was using sqlite.

```
implementation group: 'com.zaxxer', name: 'HikariCP', version: '4.0.1'
implementation group: "com.h2database", name: "h2", version: "1.4.200"
```

Thanks,
Quy

Andreas Reichel

unread,
Feb 11, 2021, 6:44:59 PM2/11/21
to h2-da...@googlegroups.com
Good Morning Quy,

unfortunately I have observed similar problems in the past: https://github.com/h2database/h2database/issues/2904

Two things:

1) when inserting large data, then you will need to remove any indices and constraints on the target table and create them only after the data are written
2) "pagination" helps, but is not very robust or reliable

Also, beyond the problem above, H2 in general is meant to take a lot of filespace -- trading of speed vs. file space efficiency.

Best regards
Andreas
--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to h2-database...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/h2-database/6359beae-5ab3-4fd2-9693-7d19fdfe48d7n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages