Databases & System Design•Part 2: Relational Databases (RDBMS / PostgreSQL / MySQL) (6 - 25)
Write-Ahead Logging (WAL) and PITR:
In Simple Words:
Before any change touches data files on disk, it is written to the append-only WAL.
Point-In-Time Recovery (PITR): Allows replaying base backups plus archived WAL logs to restore a database to the exact second prior to an accidental DROP TABLE.
bash
# PostgreSQL PITR recovery configuration (postgresql.conf / recovery.signal):
restore_command = 'cp /mnt/wal_archive/%f %p'
recovery_target_time = '2026-11-06 14:32:00 UTC'