Write-Ahead Logging
Write-ahead logging records recovery information before the corresponding changed data pages are written to durable storage. With synchronous durable commit, the required log is flushed before success is acknowledged. Data pages can be written later. Group commit lets several transactions share a flush; asynchronous settings offer different failure guarantees.
SQLite WAL stores changed page images and checkpoints them into the database file. PostgreSQL uses its own recovery records and checkpoint machinery. A checkpoint is neither a new business commit nor permission to discard every old log segment: readers, replication, and retention requirements can keep data or logs needed. A WAL file’s size is therefore not a direct measure of uncommitted work.
Batching reduces per-commit overhead by changing the transaction boundary. If batches one and two commit and batch three fails, rolling back the third does not undo the first two. Define restart and duplicate-handling rules accordingly. WAL also does not replace backups or automatically provide a complete business audit. Change-data capture must use the engine’s supported stream and restart-position protocol.
Reference: Official documentation. See the worked examples in Relational Database Internals.
Discover more from Insightful Data Lab
Subscribe to get the latest posts sent to your email.
