SQLite临时DB和InMemory DB之间的区别 [英] Difference between SQLite Temporary DB and InMemory DB
问题描述
SQLite InMemory DB和临时DB之间有什么区别?
What is the difference between SQLite InMemory DB and Temporary DB ?
参考:临时数据库
虽然我预计临时数据库是一个磁盘支持的文件数据库,临时DB几乎与内存DB相同。
While I expect Temporary DB is a disk backed file DB, the documentation is little confusing as it says temporary DB is almost same as in memory DB.
我正在寻找一个临时磁盘文件DB,其中记录被写入磁盘上的文件。
如果临时DB作为文件存储在磁盘上,我在哪里可以找到它们?我理解当连接关闭时,DB不再存在,但是当连接打开时,我希望在磁盘上找到DB。
I am looking for a temporary disk file DB, where records are written to file on the disk. If temporary DB are stored as file on the disk, where do I find them ? I understand that when the connection is closed the DB cease to exist but while the connection is open I expect to find the DB on the disk.
推荐答案
您链接到的文档说:
即使为每个临时数据库分配了一个磁盘文件,在实践中,临时数据库通常驻留在内存中的寻呼机缓存中,因此, - 由:memory:创建的内存数据库和由空文件名创建的临时数据库。唯一的区别是,:memory:数据库必须始终保留在内存中,而如果数据库变大或SQLite受内存压力影响,临时数据库的某些部分可能会刷新到磁盘。
Even though a disk file is allocated for each temporary database, in practice the temporary database usually resides in the in-memory pager cache and hence is very little difference between a pure in-memory database created by ":memory:" and a temporary database created by an empty filename. The sole difference is that a ":memory:" database must remain in memory at all times whereas parts of a temporary database might be flushed to disk if database becomes large or if SQLite comes under memory pressure.
临时数据库文件的默认位置是临时目录,文件名为 etilqs _ *
。
但是如上所述,通常没有必要将数据实际存储在此文件中。
The default location for temporary database files is the temporary directory, with a file name like etilqs_*
.
But as mentioned above, often it is not necessary for the data to be actually stored in this file.
这篇关于SQLite临时DB和InMemory DB之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!