Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLite: Does .dump copy or recreate indexes?

I am using the sqlite3 command .dump like so:

sqlite3 infile.db ".dump my_table" | sqlite3 outfile.db

At first I thought I had finally found a way to copy (among others) indexes, which would be great for parallel processing reasons.

But now it seems to me that the indexes are merely recreated as the sqlite3 infile.db process is long finished while the sqlite3 outfile.db process is still running at 100% CPU.

like image 429
Radio Controlled Avatar asked May 12 '26 11:05

Radio Controlled


1 Answers

Short answer: The command .dump recreates the indexes on the copied tables. It does not copy the indexes.

Indexes are copied using the .backup command, but this does not support addressing single tables.

like image 151
Radio Controlled Avatar answered May 14 '26 09:05

Radio Controlled



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!