sqlite - 内存中的临时数据

标签 sqlite temporary-files

我的情况:我有一个基于文件的 sqlite 数据库,并且希望在内存中完成所有临时内容(用于大型查询的临时数据库等)。我尝试使用 PRAGMA temp_store = 2 命令,但我不能 100% 确定它是否真的符合我的要求。奇怪的是,在调试时我仍然到达函数winGetTempname,它在磁盘上打开一个临时文件!

我想,一旦我设置了这个编译指示,它甚至不应该尝试打开临时文件......

我还尝试使用 TEMP_STORE 预处理器标志,但同样,对 winGetTempname 的调用仍然完成......

有什么想法吗?

最佳答案

来自documentation

The rollback journal, master journal, and statement journal files are always written to disk. But the other kinds of temporary files might be stored in memory only and never written to disk. Whether or not temporary files other than the rollback, master, and statement journals are written to disk or stored only in memory depends on the SQLITE_TEMP_STORE compile-time parameter, the temp_store pragma, and on the size of the temporary file.

从上面可以清楚地看出,如果设置正确的标志,除了日志机制之外,所有临时操作都将在内存中执行。

如果您想确保使用实用程序来监视应用程序的文件系统事件,例如 Process Monitor在 Windows 上。

关于sqlite - 内存中的临时数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1490888/

相关文章:

mysql - Sqlite 还是 MySql?如何决定?

Python 从字典中写入一个 JSON 临时文件

代码块 ".layout" ".depend"文件

sqlite - SQLite数据库不存储先前插入的数据

java - 应用程序完成工作后如何删除 ICEpdf 临时文件?

java - 如何创建一个将在 JVM 终止时自动删除的临时目录?

python - 无法将 fdopen 与 mkstemp 一起使用

sqlite - 每次更新应用程序时,我都需要创建一个新的SQLite数据库吗?

typescript - 选择每月分组日期范围内的销售额(SQLite)

android - 你能在你的android上升级sqlite3版本吗?