"Mark Allan" <[EMAIL PROTECTED]> wrote: > Can someone out there advise me as to why SQlite needs to perform > so many writes to disk when executing an insert. The insert consists > of 6 columns. There is a total of 5 indexes on the table. The average > size of one of these records is around 800 bytes. We have an SQlite > page size of 1024 bytes. But it seems that 10 pages are being written to. >
The table itself and all indices are stored separately from one another. So right away there are 6 page that need updating with any change. Then each page must be written twice - once to the rollback journal and once to the main database. This is necessary so that updates are atomic and so that an unexpected crash or power loss does not corrupt the database file. So for inserting into a table with 5 indices, I count 12 pages that need to be written, not 10. -- D. Richard Hipp <[EMAIL PROTECTED]>