When you don't wrap everything in a transaction, each statement becomes it's own transaction. And the database file is opened, updated, and closed on each transaction. So your first case had roughly 50 times the amount of file I/O and transaction startup/commit overhead as the second case.
-----Original Message----- From: Xavier Noria [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 08, 2006 10:04 AM To: sqlite-users@sqlite.org Subject: [sqlite] question about performance I have a simple schema and a sql loader that fills a table with initial values: delete from foo; insert into foo ...; insert into foo ...; ... about 50 inserts ... To my surprise, the execution of these inserts took a few seconds (SQLite is 3.3.3). However, if I wrapped the entire loader in a transaction: begin transaction; delete from foo; insert into foo ...; insert into foo ...; ... about 50 inserts ... commit transaction; then it was immediate. Why? -- fxn To find out more about Reuters visit www.about.reuters.com Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of Reuters Ltd.