Default SQLite synchronization to FULL - #483
Draft
JanJakes wants to merge 1 commit into
Draft
Conversation
Keep WAL as the default journal mode while making committed transactions durable across power loss and operating system crashes. Explicit NORMAL and other supported synchronous settings remain available as overrides.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Default SQLite connections to
WAL + FULLsynchronization.Explicit
sqlite_synchronousoverrides remain supported, includingNORMAL. The connection tests now cover the new default, overrides, and existing PDO connections whose synchronous setting was previously changed.Why
Both settings keep a WAL database consistent, but they provide different durability guarantees:
With
FULL, SQLite flushes to WAL file after each commit. WithNORMAL, synchronization happens only during checkpointing, so a successful commit can still be lost after a power failure or system crash. See the SQLite synchronous documentation and WAL performance considerations.Benchmark
A local benchmark ran a WordPress-like 90% read / 10% write workload against one database file with 4, 8, and 16 concurrent workers. Results are the combined median of ten 10-second runs across two independent batches, with a two-second warmup per run (PHP 8.5.9, SQLite 3.53.4, pure-PHP parser).
WAL + FULL performs worse than WAL + NORMAL, but it's still a significant improvement over the DELETE mode.