On 3 Jun 2011, at 3:31pm, Ian Hardingham wrote:

> Should really every single INSERT/UPDATE section have a begin/end 
> transaction around it?

That would be the slowest way to do it.  It would make each section an 
independent transaction, and at the end of the transaction all your changes 
must be cleanly written to disk.

This is also what happens if you omit the BEGIN and END SQL commands entirely.  
SQLite notices you're doing an INSERT/UPDATE without having opened a 
transaction for it, and makes that statement its own little transaction.  Then 
it finds your next change and, because it has already closed its transaction, 
has to do the same thing for that one too.  Etc. etc..

To make multiple changes as fast as possible, do a SQL 'BEGIN' command before 
your first change, and an END after the last change.  This will tell SQLite it 
can lump all the changes into one big transaction and do them all in a single 
burst of activity.

[Above explanation simplified a little for brevity.  Handwave.]

Simon.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to