SQLite Forum

How often sqlite flush to disk under NORMAL mode?
Login

How often sqlite flush to disk under NORMAL mode?

(1) By Avinash (avinash) on 2021-05-21 05:56:21 [link]

from PRAGMA - https://www.sqlite.org/pragma.html#pragma_synchronous

Is there any background thread which periodically flushes to disk?

(2) By Keith Medcalf (kmedcalf) on 2021-05-21 08:22:05 in reply to 1 [link]

No.  All operations are executed on the calling thread.  The only case where the sqlite3 library will create background threads is if `pragma threads` is a number greater than 0, the threading mode is not single thread, and then only to assist in sorting operations.

(3) By anonymous on 2021-05-21 09:06:41 in reply to 2 [link]

In that case, how sync-ing with disk works?

(4) By Kees Nuyt (knu) on 2021-05-21 13:47:50 in reply to 3

That is a very broad question, and the answers are in the documentation.

Please visit the [documentation pages][1], search for `sync`, read the relevant documents, and come back here if you have more detailed questions, not answered by the documentation.

[1]: https://www.sqlite.org/docs.html

(5) By Keith Medcalf (kmedcalf) on 2021-05-22 16:28:50 in reply to 3 [link]

See <https://sqlite.org/atomiccommit.html>