SQLite's Write-Ahead Log (WAL) mode is explained in depth, covering how it differs from rollback journals, its advantages (faster writes, concurrent readers and writers) and disadvantages (slower reads as WAL grows, no network filesystem support, single writer). The document details how checkpointing works, WAL file management, shared-memory wal-index, locking modes, and conditions that can cause unbounded WAL growth. It also discloses a newly fixed WAL-reset bug (present in SQLite 3.7.0 through 3.51.2) that could cause database corruption in rare multi-connection concurrent checkpoint/write scenarios, fixed in version 3.52.0 with backports available.
Table of contents
1. Overview2. How WAL Works3. Activating And Configuring WAL Mode4. The WAL File5. Read-Only Databases6. Avoiding Excessively Large WAL Files7. Implementation Of Shared-Memory For The WAL-Index8. Use of WAL Without Shared-Memory9. Sometimes Queries Return SQLITE_BUSY In WAL Mode10. Backwards Compatibility11. The WAL-Reset BugSort: