WAL 同步 NORMAL 与 OFF
WAL synchronization NORMAL vs. OFF
在WAL的原始文档中,FULL
和NORMAL
同步的区别有明确说明1:
Write transactions are very fast since they only involve writing the
content once (versus twice for rollback-journal transactions) and
because the writes are all sequential. Further, syncing the content to
the disk is not required, as long as the application is willing to
sacrifice durability following a power loss or hard reboot. (Writers
sync the WAL on every transaction commit if PRAGMA synchronous is set
to FULL but omit this sync if PRAGMA synchronous is set to NORMAL.)
但是我在任何地方都找不到PRAGMA synchronous = OFF
在WAL模式下的效果。我怀疑它与 NORMAL
相同。有人有知情答案吗?
documentation 还说:
In WAL mode when synchronous is NORMAL (1), the WAL file is synchronized before each checkpoint and the database file is synchronized after each completed checkpoint and the WAL file header is synchronized when a WAL file begins to be reused after a checkpoint.
所以关闭后,正常交易没有区别,但是任何checkpoint都会不安全。
在WAL的原始文档中,FULL
和NORMAL
同步的区别有明确说明1:
Write transactions are very fast since they only involve writing the content once (versus twice for rollback-journal transactions) and because the writes are all sequential. Further, syncing the content to the disk is not required, as long as the application is willing to sacrifice durability following a power loss or hard reboot. (Writers sync the WAL on every transaction commit if PRAGMA synchronous is set to FULL but omit this sync if PRAGMA synchronous is set to NORMAL.)
但是我在任何地方都找不到PRAGMA synchronous = OFF
在WAL模式下的效果。我怀疑它与 NORMAL
相同。有人有知情答案吗?
documentation 还说:
In WAL mode when synchronous is NORMAL (1), the WAL file is synchronized before each checkpoint and the database file is synchronized after each completed checkpoint and the WAL file header is synchronized when a WAL file begins to be reused after a checkpoint.
所以关闭后,正常交易没有区别,但是任何checkpoint都会不安全。