On 6 Apr 2011, at 8:14pm, Nikolaus Rath wrote:

> Simon Slavin <slavins-drl2ohjjk6tg9huczpv...@public.gmane.org> writes:
>> On 6 Apr 2011, at 5:06pm, Nikolaus Rath wrote:
>> 
>>> Another question though: what is the recommended way to insert lots
>>> of data with WAL enabled? Without a transaction, the WAL file stays
>>> small but the insertions take very long time. With a transaction,
>>> things are faster but the WAL file grows extremely big.
>> 
>> The recommended way is not to care about the size of the journal file.
>> Do it in a transaction and make sure you have some free disk space.
> 
> From http://www.sqlite.org/wal.html:
> 
> ,----
> | WAL works best with smaller transactions. WAL does not work well for
> | very large transactions. For transactions larger than about 100
> | megabytes, traditional rollback journal modes will likely be faster. For
> | transactions in excess of a gigabyte, WAL mode may fail with an I/O or
> | disk-full error. It is recommended that one of the rollback journal
> | modes be used for transactions larger than a few dozen megabytes. 
> `----
> 
> That sounds as if large transactions are not recommended with wall. Is
> that page no longer up-to-date?

I have no reason to believe that the page is not up-to-date.  Your first 
question was about how to do something with WAL enabled -- it presupposed that 
WAL was enabled.  The quote from the web page tells you that using WAL might 
not be a good idea for all situations.

Your most frequent situation for inserting 100 megabytes of data into a 
database only happens once per user: when you import the data from the user's 
old datastore.  So it happens once, under conditions where an expert in the 
software can see what's happening and monitor disk space.  Once you quit the 
importing program (which closes the only connection to the database file) the 
journal file vanishes anyway, so the fact that it was huge is a problem only 
for a short time.

Under normal situations of usage you're unlikely to encounter a transaction 
that involves more than a megabyte of data, so WAL once again becomes a 
plausible candidate for a journaling system.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to