views:

148

answers:

3

hi,

my situation: i have a file based sqlite db and want to have all temporary stuff done in memory (temp databases for large queries, etc). i tried using the PRAGMA temp_store = 2 command, but i am not 100% sure if it really does what i want. the strange thing is that while debugging i still reach the function winGetTempname which opens a temporary file on disk!

i thought, as soon as i have this pragma set, it should not even try to open a temporary file ...

i also tried to use the TEMP_STORE preprocessor flag, but again, the call to winGetTempname is still done ...

any ideas?

+2  A: 

From the documentation

The rollback journal, master journal, and statement journal files are always written to disk. But the other kinds of temporary files might be stored in memory only and never written to disk. Whether or not temporary files other than the rollback, master, and statement journals are written to disk or stored only in memory depends on the SQLITE_TEMP_STORE compile-time parameter, the temp_store pragma, and on the size of the temporary file.

From the above is clear that if you set the proper flags, all the temporary actions will be performed in the memory except the journal mechanisms.

If you want to be sure use a utility to monitor your application for file system activity like Process Monitor on Windows.

Nick D
A: 

Read this http://www.sqlite.org/inmemorydb.html

Rusted