On 9 Jan 2012, at 7:28pm, Tal Tabakman wrote:

> I have an application that perform a lot of insert operations to a table
> (each raw contains one ~20 character string and 10 integers)
> I have read a bit about insert performance and use transactions for my
> insert operations
> my question is: is there a rule of thumb regarding the optimal number of
> inserts in a transaction ?

Transactions aren't tricks for speed.  They're a part of data-handling.  A 
transaction is a bunch of operations on a database which go together: if one is 
to be done, then they're all done, if one fails, then you wouldn't want the 
others to be executed because they'd be invalid.

> i.e. suppose that all in all I have 1000000 inserts operations, what will
> be faster, to bundle 20 transactions of 50000 inserts or 10 transactions of
> 100000 inserts ?

Can't tell until you try it, with the amount of data in your rows, on your 
hardware running under your operating system.  But generally it's not important 
that your application be as fast as possible, only that it be fast enough.  So 
try your application with all those inserts in one big transaction.  Is it 
acceptably fast ?  If so, don't worry about it.

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

Reply via email to