问题
h2 seems to take up too much memory space, How to compress it
回答1:
Do you use the in-memory mode (database URL jdbc:h2:mem:test or similar)? H2 uses a pluggable file system / file system abstraction, and as part of that there is are two in-memory file system implementations, one of them compresses the data. To use it, use one of the following database URLs:
jdbc:h2:memFS:test(regular in-memory file system; a bit slower thanjdbc:h2:mem:testbut uses a bit less memory)jdbc:h2:memLZF:test(compressed in-memory file systems; slower than the above but uses less memory, maybe half or a third)
If you use the persisted mode: H2 uses quite little memory by default for the cache (16 MB), but you can reduce the cache size if needed (see the docs).
来源:https://stackoverflow.com/questions/12069224/how-to-compress-memory-space-of-h2-database-in-memory-mode