mercredi 30 mars 2016

SQLite3 pragma synchronous not peristent

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.

Aucun commentaire:

Enregistrer un commentaire