|
I don't use SQLLite much, but I expect the advice you were given was to put the bunch of INSERT statements you want into a transaction using BEGIN TRANSACTION And END TRANSACTION.
With a single insert statement in a block, you're not going to notice any difference at all because nothing has changed. What I figure is happening to you is that each insert you make is in its own transaction. Each transaction must be locked, isolated, committed, journaled, and logged atomically, distinct from everything else that is happening to the database at the same time.
If you have 2000 batches of single insert statements, you're doing all the log management steps 2000 times. If you have one batch of 2000 insert statements, you're doing a larger block of log management, but you only do it once. That would cause a performance change, hopefully for the better.
If you're going to do this regularly, you'll want to figure out how to get bulk insert or batch loading working, if SQLite supports it. Such a technique usually locks the table, batches the insert, doesn't log it, and then releases the lock. If that's appropriate for your application, it is generally much (much!) faster than individual inserts in individual transactions, or even a single transaction of many inserts.
|