TLDR Web Dev · ARTICLES & TUTORIALS

WHAT HAPPENS WHEN DATABASES CRASH?

medium.com3 min read

Summary from the TLDR Web Dev newsletter

Databases store tables and indexes in files, writing to data pages in memory, which are then written to disk. A challenge arises when there's a power loss or crash during writing, leading to corrupted files. To address this, databases use a Write-Ahead Log (WAL). This article describes how the WAL is used as a source of truth to help the database regain its bearings after a crash.