On 25 Sep 2012, at 10:54pm, David Barrett <dbarr...@expensify.com> wrote:
> If my database is X GB, and the WAL file is Y GB, how much total disk space > is required to: > > 1) Checkpoint the database I think it's a maximum of X+Y+Y (including the existing X+Y) plus or minus a page or two. > 2) Vacuum the database I think it's a maximum of 3*(X+Y) (including the existing X+Y) plus or minus a page or two. It might be 2*(X+Y). I'm not certain how of how checkingpointing is done. Both of those answers are dependent on the database not being corrupt, and SQLite being in a proper working state. > Additionally, if there are any temporary files created, where do they > exist? We've done some poking around and are having some crazy theory > about a temporary file being created inside /tmp, but in a *deleted* state. As far as I know, SQLite does not intentionally play tricks like that. Your OS may report the length of a temporary file as zero because it's still open, but SQLite is just using the normal file writing calls. > I'm guessing we're wrong, so I figured it would be easiest just to ask. Good strategy. You might find something interesting from this PRAGMA: <http://www.sqlite.org/pragma.html#pragma_temp_store_directory> though you should read the notes first. But as a rule SQLite will create temporary files in just two places: the folder the database is in, and wherever your OS thinks temporary files should be (e.g. /tmp, C:\windows\temp). There are some problems with OSen like Android which do not have a built-in concept of a temporary folder. For those, I believe the temporary folder is set at compilation time. I did once find SQLite creating temporary files on the root of my boot disk. This problem was traced to the fact that the disk format (not the database format) was corrupt ! Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users