On Mon, Feb 07, 2011 at 10:55:47AM -0500, Mark Phippard wrote:
> On Mon, Feb 7, 2011 at 10:52 AM, Stefan Sperling <stsp_at_elego.de> wrote:
>
> > Where is the temporary table stored? Is it back by a file or memory?
> > If backed by memory, do we have to worry about memory consumption for
> > large working copies?
>
> The patch says it is backed by a file.
Yes, it does say that in a comment but I didn't see where this is being
enforced in the code.
Checking the sqlite docs gave the answer:
"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."
http://sqlite.org/inmemorydb.html
This is what the patch does:
+-- STMT_ATTACH_TEMPORARY_DATABASE
+ATTACH DATABASE '' AS temp_query_cache;
And note that the sqlite docs also say:
"Even though a disk file is allocated for each temporary database, in
practice the temporary database usually resides in the in-memory pager
cache and hence is very little difference between a pure in-memory
database created by ":memory:" and a temporary database created by an
empty filename. The sole difference is that a ":memory:" database must
remain in memory at all times whereas parts of a temporary database
might be flushed to disk if database becomes large or if SQLite comes
under memory pressure."
Neat :)
Received on 2011-02-07 17:19:40 CET