如何使用命令行工具sqlite3浏览内存SQLite数据库
有没有办法使用 sqlite3 CLI 工具将整个 SQLite 数据库加载到内存中以获得更快的结果?谢谢!
Is there a way to load an entire SQLite database into memory for faster results, using the sqlite3 CLI tool? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这篇文章提供了一个很好的例子,即:
然而,我有点失望,因为改进我所希望的速度没有得到满足。我想我并不孤单。我尝试的数据集是> 300MB,远远超出了此处给出的默认页面缓存大小,因此您可能会认为将整个数据库加载到 RAM 中会产生明显的结果,但事实并非如此。有什么想法吗?
This article provides a good example, namely:
However, I was a bit disappointed, since the improvements in speed I was hoping for were not met. I guess I'm not alone. The data set I tried is > 300MB, well beyond the default page cache size given there, so you would imagine that loading the entire database into RAM would yield noticeable results, but wasn't really the case. Any thoghts?
我不确定你想在这里完成什么,但我有两个想法要提出:
1-将数据库中的所有内容复制到内存数据库中附加的一些内容。此链接将告诉您如何附加内存数据库:http://www.sqlite.org/lang_attach。 html
2- 增加缓存大小,将事务保留在内存中,并将“临时存储”保留在内存中:
http://www.sqlite.org/pragma.html#pragma_cache_size
http://www.sqlite.org/pragma.html#pragma_journal_mode
http://www.sqlite.org/pragma.html#pragma_temp_store
I'm not sure of what you are trying to accomplish here, but I have two ideas to propose:
1- Copy everything from your database to some attached in memory database. This link will tell you how to attach an in memory database: http://www.sqlite.org/lang_attach.html
2- Increase your cache size, keep transactions in memory, and keep the "temp store" in memory:
http://www.sqlite.org/pragma.html#pragma_cache_size
http://www.sqlite.org/pragma.html#pragma_journal_mode
http://www.sqlite.org/pragma.html#pragma_temp_store
将
--deserialize
传递给sqlite3
CLI 工具。Pass
--deserialize
to thesqlite3
CLI tool.