3 ms·
Sure, use WAL journal mode and then run "PRAGMA synchronous=NORMAL". Documentation is at https://sqlite.org/pragma.html#pragma_synchronous https://sqlite.org/pr
by tobias3 6y ago
Sure, use WAL journal mode and then run "PRAGMA synchronous=NORMAL". Documentation is at https://sqlite.org/pragma.html#pragma_synchronous https://sqlite.org/pragma.html#pragma_synchronous . The default is FULL (compile time option SQLITE_DEFAULT_SYNCHRONOUS ) which makes SQLite durable, but naturally causes a fsync() at every commit. With NORMAL it only runs fsync() once it checkpoints from WAL to db file.
I run it with synchronous=NORMAL, but set it to FULL for specific transactions which I want to be durable. Then I turn off auto checkpointing and manually run WAL checkpointing in another thread once it is relatively large. That way it runs fsync() really rarely. That more performant setup is a bit complicated (and error prone) so it is no wonder that it is rarly done. Though I hope Firefox does it nowadays.