Real databases, explained with real files.

The number that runs this pageOne lookup in a 10-million-row table takes 0.05 ms with the right index, or 3 to 8 seconds without one. Same data, same hardware, same query. The difference is entirely physical: which pages get read, and how many.

I run production databases for a living. This site is for a DBA or backend engineer who wants to go from zero to staff level, starting from the files on disk.

Three engines, one job. Each solves it with a different physical layout, and the layout is the behavior. Once you know where the bytes sit, the performance follows.

PostgreSQL

Best when correctness matters most.

One data directory. Each table and each index is its own file of 8 KB pages. Updates write a brand-new row version; VACUUM cleans the old ones.

Log: WAL in pg_wal/ · Data: base/<db>/<file> · Memory: shared_buffers

PostgreSQL, in one line →

MySQL · InnoDB

Best for fast websites where most lookups are by ID.

Each table is one .ibd file that is the primary-key index. Rows are stored in ID order, 16 KB pages. Two logs: redo for crashes, binlog for copies.

Logs: #innodb_redo/#ib_redo0 + mysql-bin.* · Data: shop/users.ibd · Memory: buffer pool

MySQL · InnoDB →

MongoDB · WiredTiger

Best when every record looks a bit different.

Documents instead of rows. Each collection and index is its own compressed .wt file. Copies follow the oplog, a special collection in the local database.

Logs: journal/WiredTigerLog.* + local.oplog.rs · Data: collection-*.wt · Memory: WiredTiger cache

MongoDB · WiredTiger →

Architecture · one picture per engine

Same job, same shape, different files

Every engine on this site does the same four things in the same order: a client connects, the change lands in memory, the log records it first, and the data files catch up later. The three pictures are drawn the same way on purpose, so the comparison lands. The names inside them are the real file and memory names. The log box is the one that matters: COMMIT returns only after the log is on disk.

PostgreSQL

Clientbackend per connection
→
Memoryshared_buffers
→
Log, firstWAL in pg_wal/
→
Data, laterbase/ files, 8 KB pages

MySQL · InnoDB

Clientthread per connection
→
Memorybuffer pool
→
Log, firstredo #ib_redo0 + binlog
→
Data, laterusers.ibd, 16 KB pages

MongoDB · WiredTiger

Clientdriver connection
→
MemoryWiredTiger cache
→
Log, firstjournal + oplog
→
Data, latercollection-*.wt files

Follow one insert through these boxes, and watch it cross each one: Follow one insert, end to end →

Start here · pick your path

Three ways in, depending on how much time you have

10 min

The insert plus the three rules

Follow one row end to end. Learn the three rules that run every database on this site.

30 min

The incident cards

Eight ways apps break. Each card has the exact check I run first.

2 hr

The full guided path

Six levels. Eighteen problem and diagram pairs. Zero to staff level.

Decisions: Synchronous replication and failover, what a commit waits for before it returns.

Real stories

Sixteen times a real database broke

Uber, Notion, Adyen, Figma, Dropbox, GitHub, Slack, Shopify, Epic Games, GitLab, and Instacart. Each story has the numbers, the fix, and the lesson I took from it. Read the stories →

What's new

What changed, and when

I update this log when the site changes. New pages first. Small fixes do not get a line.