On 17 Dec 2017, at 10:18pm, Dinu <dinumar...@gmail.com> wrote:

> For the table swap operation, that is out of the question, the DB is running
> on a live system that has multiple clients. Foreign keys or not, any
> structure change crashes all clients (DB structure has changed). Too high a
> price to pay for a delete thay may happen routinely.

Okay.  In that case you might try this.  The reason it may be fast is that 
SQLite has DROP without a WHERE clause optimized.  It happens very quickly.

BEGIN IMMEDIATE
create a temporary table with the same columns as MyTable, but no indexes
copy the rows you need to keep to the temporary table
DELETE FROM MyTable
copy all rows from the temporary table back to the original table
COMMIT

As with the last suggestion, the only reason I think these my be faster is that 
you are keeping less than half the rows in the original table.

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

Reply via email to