如何压缩H2数据库的内存空间(内存模式)? [英] How to compress memory space of h2 database ( in-memory mode)?

查看:837
本文介绍了如何压缩H2数据库的内存空间(内存模式)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

h2似乎占用了过多的内存空间,如何压缩

h2 seems to take up too much memory space, How to compress it

推荐答案

您是否使用内存模式(数据库URL jdbc:h2:mem:test或类似地址)? H2使用可插拔文件系统/文件系统抽象,其中一部分是两种内存文件系统实现,其中一种压缩数据.要使用它,请使用以下数据库URL之一:

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(常规的内存文件系统;比jdbc:h2:mem:test慢一点,但使用的内存少一点)
  • jdbc:h2:memLZF:test(压缩的内存文件系统;比上述速度慢,但使用较少的内存,可能是一半或三分之一)
  • jdbc:h2:memFS:test (regular in-memory file system; a bit slower than jdbc:h2:mem:test but 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)

如果使用持久模式:默认情况下,H2的缓存使用的内存很少(16 MB),但是如果需要,您可以减小缓存的大小(请参阅文档).

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).

这篇关于如何压缩H2数据库的内存空间(内存模式)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆