0

I create a SQLite file like this:

sqlite3 output.db < myinserts.sql

Unfortunately it takes hours, so I want to speed it up by using the following PRAGMAs:

PRAGMA synchronous=OFF
PRAGMA count_changes=OFF
PRAGMA journal_mode=MEMORY
PRAGMA temp_store=MEMORY

QUESTION: How to set them on the command line?
It is for a script so I don't want interactive mode, I want to do all in a single command line.

1

I have not found an easy way to specify these on command line, but a workaround can be to put these lines at the beginning of the SQL input:

echo "PRAGMA synchronous=OFF;PRAGMA count_changes=OFF;PRAGMA journal_mode=MEMORY;PRAGMA temp_store=MEMORY" \
  > tmp.sql
cat myinserts.sql >> tmp.sql
sqlite3 output.db < tmp.sql
rm tmp.sql

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.