I have been struggling with the performance of insertion in sqlite.

Here we have a very simple case :

A table with an integer autoincrement primary key and a text field that is
unique.

CREATE TABLE my (id PRIMARY KEY, url);

CREATE UNIQUE INDEX myurl ON my(url);


My application requires inserting up to 10 million records in batches of
20 thousand records.

For each group of 20000 records, first insert them into a TEMP table.
Call the temp table t1.  Then transfer the records to the main table
as follows:

     INSERT OR IGNORE INTO my(url) SELECT url FROM t1 ORDER BY url;


D. Richard Hipp
[EMAIL PROTECTED]




-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to