I need a very fast SQLite database acces. Setting parameters this way:
PRAGMA synchronize = OFF
PRAGMA jorunal_mode = MEMORY
makes the speed to be enough for my project.
These settings makes SQLite to leave synchronization with database file in the hands of operating system.
But there are a few cases, some certain inserts, after which I must be sure that the data was written to the disk.
Is there any way I can force SQLite to write all data (waiting in memory journal) to disk?
Thanks.
I would suggest you use the recently implemented
WALjournal_mode. This way, you can leavesynchronoustonormaland have all your writes written to disk as you go:The above is taken from:
http://www.sqlite.org/wal.html
If that is not enough, you can still then invoke
PRAGMA database.wal_checkpoint;when you want to be certain that your writes are not only written to disk, but also “integrated” to your DB. Check the following for more information:http://www.sqlite.org/pragma.html#pragma_wal_checkpoint