Databases for Developers

Lesson 1 of 10 · 16 min

x
10%

How Databases Work

A database is not just a file. Under the hood, every database engine manages pages of data on disk, a buffer pool in memory, a write-ahead log for crash recovery, and a query planner that turns your SQL into an execution plan. Understanding these pieces tells you why certain queries are fast, why indexes matter, and why writes are durable even after a power failure. Storage engines like InnoDB (MySQL) and the Postgres heap store rows in fixed-size pages (usually 8KB). Reads load pages into the buffer pool; writes go to the log first, then flush to disk asynchronously. The query planner evaluates multiple access strategies — sequential scan, index scan, hash join — and picks the cheapest one based on table statistics.

Key Takeaway

Databases manage pages, buffer pools, and write-ahead logs — understanding this explains every performance decision you'll ever make.

Next Lesson