SQLite Forum

Timeline
Login

4 forum posts by user jtenos

2021-04-30
05:29 Reply: Where is the temporary database file stored? (artifact: f9f1b379ef user: jtenos)

Awesome, I'll give that a try, might make things easier to test.

Thanks

05:24 Reply: Where is the temporary database file stored? (artifact: 54e3f55fa2 user: jtenos)

Thanks. So it sounds like you're also saying that the temporary file is only generated when it needs to be, rather than every time.

I guess I'll just dig in and make a big data set and see if I can watch /tmp and see anything happen.

05:21 Reply: Where is the temporary database file stored? (artifact: 91c870ee19 user: jtenos)

Thanks. It does say "a new temporary file is created" - emphasis on "is" rather than "may be" - unless of course I disagree with the documentation on the meaning of the word "is" (throwback to the 90s).

The reason I'm asking is I do want to see it in action in testing, before I use it for real. For example, suppose this actually doesn't work with the library I'm using for whatever reason, and an empty string actually writes fully to memory rather than to disk - if I tried using this on something that's too big, it would crash (I assume) rather than spill over to disk. If I can watch it as it's happening, then I can be confident it'll work with larger sets of data.

I suppose I can just do some bigger testing with a few GB of dummy data, and keep an eye on the /tmp directory and the system monitor for RAM usage. I figured I'd confirm that /tmp is right first.

04:05 Post: Where is the temporary database file stored? (artifact: e554503dd7 user: jtenos)

According to the In-memory documentation:

When the name of the database file handed to sqlite3_open() or to ATTACH is an empty string, then a new temporary file is created to hold the database.

I'm trying this out, on a Mac, and I've tried with Python and with Deno. I'll use ":memory:" as the name, and "" as the name, and they seem to do the same thing. I don't see a file created on disk in the current directory or in /tmp. Where else should I be looking to see this file get created and automatically deleted?