Skip to content

Default SQLite synchronization to FULL - #483

Closed
JanJakes wants to merge 1 commit into
trunkfrom
synchronous-default
Closed

Default SQLite synchronization to FULL#483
JanJakes wants to merge 1 commit into
trunkfrom
synchronous-default

Conversation

@JanJakes

@JanJakes JanJakes commented Aug 11, 2026

Copy link
Copy Markdown
Member

Summary

Default SQLite connections to WAL + FULL synchronization.

Explicit sqlite_synchronous overrides remain supported, including NORMAL. 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:

Failure WAL + NORMAL WAL + FULL
PHP or application crash Committed transactions survive. Committed transactions survive.
OS crash or power loss Database remains consistent, but recent successful commits may disappear. Successful commits survive when storage honors synchronization.
Transaction not committed The transaction rolls back. The transaction rolls back.

With FULL, SQLite flushes to WAL file after each commit. With NORMAL, 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).

Workers Configuration Ops/s (speedup) p50 p95 p99
4 DELETE + FULL 7,631 (1.0×) 0.100 ms 1.380 ms 10.133 ms
4 WAL + NORMAL 37,640 (4.9×) 0.095 ms 0.115 ms 0.150 ms
4 WAL + FULL 34,883 (4.6×) 0.098 ms 0.145 ms 0.176 ms
8 DELETE + FULL 7,936 (1.0×) 0.101 ms 3.859 ms 21.135 ms
8 WAL + NORMAL 56,103 (7.1×) 0.097 ms 0.126 ms 1.396 ms
8 WAL + FULL 43,874 (5.5×) 0.100 ms 0.157 ms 1.421 ms
16 DELETE + FULL 7,888 (1.0×) 0.103 ms 4.151 ms 38.256 ms
16 WAL + NORMAL 59,372 (7.5×) 0.108 ms 0.145 ms 1.443 ms
16 WAL + FULL 47,829 (6.1×) 0.101 ms 0.169 ms 1.467 ms

WAL + FULL performs worse than WAL + NORMAL, but it's still a significant improvement over the DELETE mode.

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.
@JanJakes JanJakes mentioned this pull request Aug 11, 2026
13 tasks
@JanJakes

Copy link
Copy Markdown
Member Author

Following a discussion with @adamziel, we agreed to keep the default at NORMAL.

@JanJakes JanJakes closed this Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant