On Tue, Nov 27, 2012 at 11:16 PM, Keith Chew <keith.c...@gmail.com> wrote:

> I have found that after performing 5000 single transaction inserts, the WAL
> size grows to approx 90MB. After a checkpoint, it becomes 0 and the main
> DB's size goes up by less than 2MB. Is my observation correct? Ie am I
> expecting such a huge size difference between the WAL and main DB file
> formats?
>

In WAL mode, SQLite appends deltas of the database changes to the WAL
file.  Each transaction commits as its delta is appended.  The checkpoint
operation transfers these deltas into the main database file.  Prior to a
checkpoint, the main database file is unchanged in WAL mode.  In WAL mode,
a checkpoint is the only operation that ever changes the main database.

If you do 5000 transactions without a checkpoint, and the delta for each
transaction is 4 or 5 pages of 4KB each, that would come to about 90MB.
You might want to consider doing checkpoints more frequently to prevent the
WAL file from growing so large.


-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to