Re: SQLite inserts slow

Sebastien Bigaret <[email protected]> 29 Jun 2004 20:37:55 +0200
Newsgroups gmane.comp.python.modeling
Message-ID <[email protected]>
Ok fine, and indeed, I've just read the documentation
  http://www.hwaci.com/sw/sqlite/lang.html#pragma
and this definitely seems to be far less dangerous than what I thought it
could be.

Do you think this could be useful enough to have a setting to control that
within the framework? For example we could have a env.variable
'SQLITE_SYNCHRONOUS_MODE' set to either 'NORMAL' (default), 'FULL' or 'OFF',
an env.var. that the framework could use to set the synchr.mode when opening a
connection.

  While we're at it, are there other PRAGMAs that you all using
  sqlite think they should be controlled in the same way?

-- Sébastien.


Ernesto Revilla <[email protected]> wrote:
> Hi again,
> 
> Sebastien Bigaret escribió:
> 
> >>Interesting enough that the following instruction makes it much faster
> >>causing SQLite to turn off disk sync:
> >>*PRAGMA default_synchronous = OFF;
> >>
> >
> >Yes, but this makes the sqlite-db file very fragile, I believe this can
> >completely waste your data when some errors happen, or am I wrong? (no
> >time to check that in details right now)
> >
> >
> It depends. sqlite writes all changes to a journal file, and when commiting
> processes the journal file and appends the results to the end of the
> file. The fragile point is after the journal file has been processed, bu
> before the data has been written to disk. Of course, this makes it more
> fragile, but the probability of a system crash is not very high, provided we
> are using powersupplies and stable OS. If we have a patch for this issue,
> I'll turn on syncing again.
> 
> With best regards,
> Erny



-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com