SQLite Forum

PRAGMA temp_store_directory
Login
> So, not sure how to work if that is deprecated, as I have 10 connections to 10 different DB and how I set temp folder for each connection separately?

Have ten processes with one connection per processes.  The "temp directory" concept is a per-instance (of the computer) or per-process concept on every single Operating System ever devised so far.

Or you could write a new OS that maintains a temp folder per thread.

However, presently, no Operating System does this.  Most of them have a single temp directory per process and its location is inherited from its parent process by default, although the parent process can "change" the diaper (temp store location) for its baby processes to pee in.  SQLite3 allows you to override the current process diaper location, but only for the current process (and everything it contains) that is SQLite3 related.

 > But I don't really understand if this connection to the same DB or any connection within same process will be broken ? Also found that

Since there is one temp directory active PER PROCESS at one time, changing the TEMP STORE DIRECTORY affects all connections in that process from the time the change is made.

 >> Changing the temp store directory setting is not threadsafe. Never change the temp store directory setting if another thread within the application is running any SQLite interface at the same time. Doing so results in undefined behavior. Changing the temp store directory setting writes to the sqlite3tempdirectory global variable and that global variable is not protected by a mutex.

 > So, here it's confuses even more.

Seems pretty straight forward.  The temp store directory is a process wide setting.  It is not threadsafe.  If you change the temp store directory while at the same time also using it in another thread, you will release the hounds of hell who will promptly eat your program and drag you down into the hellfires for all eternity.

It is simply being somewhat more technical to avoid offending those with delicate sensibilities or weak constitutions.


Putting all that aside, why in the multiverse do you think you need a separate temp directory for each connection?  Is it a PHB thing?