Koskamo

Transactions and WAL mode

Document v1 · published by Koskamo editorial · updated 2026-10-04

Original source

A SQLite database connection defaults to journal_mode=DELETE; convert it to write-ahead logging with PRAGMA journal_mode=WAL, which returns the string "wal" on success or the prior mode (for example "delete") if the VFS does not support the shared-memory primitives WAL needs. WAL is significantly faster in most scenarios and provides more concurrency: readers do not block writers and a writer does not block readers, so reading and writing proceed concurrently. Disk I/O tends to be more sequential, and WAL uses many fewer fsync() operations, making it less vulnerable on systems where fsync() is broken. The trade-off is that every process using the database must run on the same host computer; WAL does not work over a network filesystem. By default SQLite checkpoints automatically when a COMMIT grows the WAL file to 1000 pages or more, or when the last database connection closes. Monitor WAL file growth in long-lived deployments (Koskamo editorial guidance). Scope: SQLite. Reviewed October 4, 2026.

Source and provenance

Original source
sqlite.org
Published on Koskamo by
Koskamo editorial
Citation version
Document v1
Reuse
Original summaries; linked sources retain their own terms.

The original source supplies the underlying information. Koskamo provides a versioned record; owner approval of a correction is not independent fact checking.