temp_store
Where temporary tables and indexes go: compile-time default, file or memory.
- По умолчанию
0 (DEFAULT, which means file)- Range
- 0 DEFAULT, 1 FILE, 2 MEMORY
- Restart needed
- Нет
- Default checked on
- SQLite 3.5x
Что оно делает
0 (DEFAULT) uses the compile-time SQLITE_TEMP_STORE setting, which is 1 (file) in stock builds. Large sorts, GROUP BY and temporary tables use this storage.
Значение по умолчанию
0 (DEFAULT, which means file). 0 (a stock SQLite 3.5x build, compiled with SQLITE_TEMP_STORE=1).
Check the current value
PRAGMA temp_store; SELECT * FROM pragma_temp_store; -- table-valued form, usable in queries
Change it
PRAGMA temp_store = MEMORY; -- this connection only
No restart. It applies at once to the connection that runs it and is lost when that connection closes, so set it every time a connection opens.
When to change it
Set MEMORY for speed when the temporary data fits comfortably in RAM, as on most desktop and server apps.
What can go wrong
Large sorts or temp tables in MEMORY can exhaust RAM on small devices.
Questions about temp_store
What is the default value of temp_store in SQLite?
0 (DEFAULT, which means file). 0 (a stock SQLite 3.5x build, compiled with SQLITE_TEMP_STORE=1).
Does changing temp_store require a restart?
No. No restart. It applies at once to the connection that runs it and is lost when that connection closes, so set it every time a connection opens.
When should I change temp_store?
Set MEMORY for speed when the temporary data fits comfortably in RAM, as on most desktop and server apps.
Back to all SQLite settings, or check the SQLite manual for every option.
Related on SQLly
Check temp_store on your own server
SQLly runs the query above against SQLite and the other engines in this reference, from one desktop app on macOS, Windows and Linux.