WAL ensures durability by writing changes to a log before applying them to data files.
How it works:
Transaction writes changes to WAL
WAL flushed to disk (fsync)
Transaction commits
Later, changes applied to actual data pages
Recovery:
After crash, replay WAL from last checkpoint. All committed transactions are recovered.
Performance:
Sequential WAL writes are faster than random data page updates. Batching improves throughput.