Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between SQLite Temporary DB and InMemory DB

What is the difference between SQLite InMemory DB and Temporary DB ?

Reference: Temporary 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.

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.

like image 244
Abee Avatar asked Feb 09 '26 19:02

Abee


1 Answers

The documentation you linked to says:

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.

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.

like image 194
CL. Avatar answered Feb 12 '26 14:02

CL.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!