SQLite Forum

Feature request: add an optional transaction size in mode insert
First of all, thank you very much for SQLite, it is wonderful!

An operation that I do often is batch import records into SQLite, sometimes exported from other SQLite db. For that, I use this idiom:

$ sqlite3 -cmd '.mode insert mytable' old.db 'select * from mytable;' | sqlite3 new.db

If mytable is very large, this operation may take a long time, and I have to do more cumbersome operation to provide transactions.  I think it would be very useful to add an optional numeric parameter that, if provided, would create transactions, for example:

$ sqlite3 -cmd '.mode insert mytable 10000' old.db 'select * from mytable;' | sqlite3 new.db

Would create a transaction every 10000 records, and the operation would be much faster with this minimal addition.

Thanks again,

Ferran Jorba

Edit: add the forgotten select statement in the examples