Name
temp_store_directory — Control the temporary file storage location
Common Usage
PRAGMA temp_store_directory;
PRAGMA temp_store_directory = 'directory_path';Description
The temp_store_directory pragma gets or sets the
location used for temporary database files. This pragma does not
change the location of journal files. If the specified location
is not found or is not writable, an error is generated.
To revert the directory to its
default value, set
to a zero-length string. The default value (as well
as the interpretation of this value) is OS dependent.directory_path
Changing this pragma will cause all temporary databases (and the data they contain) to be deleted. Setting this pragma is not thread-safe. Ideally, this pragma should only be set as soon as the main database is opened.
Many temporary databases are never actually created on the filesystem, even if they’re set to use a file for storage. Those files that are created are typically opened and then immediately deleted. Opening and deleting a file keeps the file active in the filesystem, but removes it from the directory listing. This prevents other processes from seeing or accessing the file, and guarantees the file will be fully deleted, even if the application crashes.
See Also
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access