On 04/08/2011 04:42 PM, Jaco Breitenbach wrote:
> Dear experts,
>
> My application makes use of a SQLite table with a unique index.  During
> normal processing, the unique index is used to ensure no duplicate records
> are entered into the table.  However, at regular intervals large numbers of
> records (millions of records) that are already known to be unique, are
> inserted into the SQLite table from another source.  In order to speed up
> these bulk inserts, I first drop the index on the SQLite table, do the bulk
> insert, and then recreate the index.
>
> The problem I'm encountering is that dropping of the index can potentially
> take much longer than recreating it.  In a test I've run this morning, it
> took 53 minutes to complete the "DROP INDEX my_unique_index", but only 9
> minutes to recreate it.

Is your database an auto-vacuum database? If so, it might be faster if
you issue a "PRAGMA auto_vacuum = 2" before dropping the index.

Dan.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to