SQLite Forum

Temp database
Login
You will note that when you specify a filename ('filename.db' for example) then that file is opened and used as the database.

When you specify a filename ':memory:' then a database exclusive to that connection is created entirely in memory.  No part of it will reside on disk.

If you create a temporary database by specifying a blank filename (ie, '') then the database will be created and treated according to the TEMP_STORE currently set.  If TEMP_STORE is currently set to memory only, then there is no difference between a ':memory:' database and a '' database.

In the default case, a '' (temporary) database resides in a temporary disk file, however, since the disk file is temporary, data will not be written to disk until memory is exhausted.

<https://sqlite.org/pragma.html#pragma_temp_store>