Why is my H2 database 7x larger on disk than it should be?

前端 未结 2 547
轮回少年
轮回少年 2021-01-29 07:26

I have an H2 database that has ballooned to several Gigabytes in size, causing all sorts of operational problems. The database size didn\'t seem right. So I took one little slic

相关标签:
2条回答
  • 2021-01-29 08:17

    There's always indices, etc. to be taken into account.

    Can you try:

    CALL DISK_SPACE_USED('my_table');

    Also, I would also recommend running SHUTDOWN DEFRAG and calculating the size again.

    0 讨论(0)
  • 2021-01-29 08:22

    Setting MV_STORE=FALSE on database creation solves the problem. Whole database (not the test slice from the example) is now approximately 10x smaller.

    Update

    I had to revisit this topic recently and had to run a comparison to MySQL. On my test dataset, when MV_STORE=FALSE, the H2 database takes up 360MB of disk space, while the same data on MySQL 5.7 InnoDB with default-ish configurations takes up 432MB. YMMV.

    0 讨论(0)
提交回复
热议问题