What happens when databases crash?

Databases have tables and indexes stored in files. As you create rows, the database system writes to data pages in memory which is then written to data files on disk. There is a problem though, what happens if you lose power half-way through writing to the file? As the database starts back up we have corrupted files.Continue reading “What happens when databases crash?”

Why databases need Write-ahead log (WAL) — A deep dive.

Foundational principal of any durable database system. In any database system there are often two major storage units, data and indexes. Data represents tables, collections or graphs. Indexes fast-path lookups to data often created with B+Tree data structure. Pages Both data and indexes live as fixed-size pages in data files on disk. Databases may do it differentlyContinue reading “Why databases need Write-ahead log (WAL) — A deep dive.”