I am using an SQLite3 database i WAL-mode. The default mode for pragma statement synchronous is 2 (full), but this makes inserts really slow and according to documentation 1 (normal) should be fine.
Changing synchronous mode works as long as the database is open, but seems to reset when the connection is ended:
root@linux:~# sqlite3 mydb.db
SQLite version 3.8.6 2014-08-15 11:46:33
sqlite> pragma synchronous;
2
sqlite> pragma synchronous=1;
sqlite> pragma synchronous;
1
sqlite>[exit]
root@linux:~# sqlite3 mydb.db
SQLite version 3.8.6 2014-08-15 11:46:33
sqlite> pragma synchronous;
2
Nothing else is using the database. Can anyone tell me how to make this change persistent?
Also, what is the difference between setting pragma synchronous
and pragma [database name].synchronous
? Neither is persistent, by the way.
Like most other PRAGMAs, this setting applies not to the database but to the database connection.
It cannot be made persistent. You have to make it whenever you open the database.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With