November 03, 2008

Why is INSERT / UPDATE command very bad performance on SQLite?

When you do a lot of INSERT / UPDATE on a table, it is a good time to contain them within a transaction,

begin;
insert into table values (..);
insert into table values (..);
insert into table values (..);
....
commit;

This will make SQLite save all changes to the disk at once.

Reference in SQLite:
http://www.sqlite.org/cvstrac/wiki?p=PerformanceConsiderations