Write-Ahead Logging
A technique of writing changes to a log before applying them to the main database.
Write-Ahead Logging (WAL) is a fundamental technique in nearly all modern databases for guaranteeing durability (the D in ACID). Before a database operation actually modifies pages, a log record is written to a sequential log file on disk. If the system crashes after the log entry is written but before the change is applied, the recovery process can replay the log and complete the operation.
This technique enables buffer caching without risking data consistency—you can hold changes in memory until the batch is large enough to write efficiently, but you must first ensure the operation is logged persistently. WAL was so effective that it was used in early systems and is now standard in virtually all transactional databases from SQLite to Oracle to PostgreSQL.