内存数据库也有文件系统组件吗?
我正在使用 Datamapper,它允许您指定系统上数据库文件的路径,或者简单地指定字符串“内存”,然后使用“内存中”数据库。 但是,我不知道这意味着什么。
“内存中”数据库是纯粹基于内存的,还是在某个时刻序列化到文件系统?
内存数据库有什么好处?
仅仅是为了提高效率 - 通过消除文件系统访问的成本吗?
I'm working with Datamapper which allows you to specify either a path to a database file on your system or simply the string "memory" and then an "in-memory" database is used. However, I have no idea what this means.
Is an "in-memory" database purely memory-based or does it get serialized to the filesystem at some point?
What's the benefit of an in-memory database?
Is it simply for efficiency - by removing the cost of filesystem access?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
SQLite 拥有内存数据库的原因并不是真的为了性能。 实际上,拥有一个文件并不比跳过它慢,除非内存不足。 它实际上主要用于临时缓存或测试。 例如,您可以使用内存数据库进行单元测试,这样您就不会遍历生产数据。 或者,如果您需要 SQL 功能,您可以使用它作为 memcache 的替代品。 基本上,它就在那里,所以如果您不需要的话,您就不必保存数据。
The reason why SQLite has in-memory databases isn't really for performance. In practice, having a file isn't really any slower than skipping that, except if you run out of memory. It's really mostly for temporary caching or testing. For instance you could use an in-memory db for your unit tests, so that you don't walk on production data. Or you could use it as an alternative to memcache if you wanted SQL functionality. Basically, it's there so you don't have to persist data, if you don't need to.
来自 SQLite 文档:
From the SQLite documentation: