Hayden Livingston wrote:
> I have a program that writes hundreds of thousands of statements that
> are logically unrelated, i.e. each is "transactional".
>
> The problem is if I don't do a BEGIN TRANSACTION and do my inserts, it
> takes absolutely forever for my program to finish (we're talking
> hours).
>
> If instead I do it in a single transaction (i.e. BEGIN TRANSACTION, 1
> million inserts, END) it dramatically improves the time.
>
> Is there a way to get this behavior without transactions? The reason
> is most of the times the program is terminated by a user action and I
> don't get a chance to END the transaction.

What do you mean with "terminated"?  Process killed?  Powered off?

> I'm considering doing "periodic transactions", i.e. buffer in my
> application X statements and club them together.

Instead of a fixed X, consider a maximum time before committing.

Anyway, try using WAL mode with PRAGMA synchronous = normal:
<http://www.sqlite.org/wal.html>
<http://www.sqlite.org/pragma.html#pragma_synchronous>


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to