See what your database is really doing.

Watch a query move through PostgreSQL, MySQL, MongoDB, Redis and Cassandra, step by step, with numbers measured on real servers. Then put it to work: pick the right database, design the tables, and fix it when it breaks.

I run production databases for a living. This is the site I wanted when I started.

Got one minute? Today's three database questions →

One minute a day

Guess what the database does

Three questions, new every day. Every answer comes from a real measurement or a lesson on this site, and links to it.

Loading today's questions…

The course

Eight steps from one query to a whole system

Short videos

One idea, under a minute

One missing index: 19,231 pages to find one row

A network split: Cassandra keeps both writes, then loses one

The dual write bug: the order saved, the event lost

Random UUIDs: why MySQL inserts got 10 times slower

All 12 videos →

The whole site

Or go straight to what you need

Four parts, each answering one question. The menu at the top has every page in them.

Part 1 · Learn

How do databases actually work?

From one row on disk to transactions: the words you need, PostgreSQL, MySQL and MongoDB from the files up, then Redis, Cassandra and vector search, side by side, and the query and concurrency traps.

and 17 more →Start with The course →
Part 2 · Practice

Can I see it happen?

Simulations, an index you build yourself, a real PostgreSQL in your browser, experiments run on real servers, and tools for your own database: a query coach, an EXPLAIN reader, a config checker and a health check.

and 3 more →Start with The daily →
Part 4 · Operate

How do I run it in production?

What to check when it is slow or broken, where it runs and what it costs, how big it must be, pooling, backups, security, upgrades and other changes made safely.

and 9 more →Start with Something is slow or broken →

Not sure where to begin? Pick the path for your goal, or open your map of every lesson, with the ones you have read ticked.

Three engines, one job

Where the bytes sit decides how it behaves

The number that runs this pageOne lookup in a 10-million-row table takes about 0.05 ms with the right index, or about 0.7 seconds without one. Same data, same hardware, same query. The difference is entirely physical: which pages get read, and how many. Notebook 3 measured 0.04 ms and 70.5 ms at 1 million rows; these figures scale that run up tenfold.

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 →

The same write, crash and replica in each engine, side by side: Engines side by side →

Real stories

Nineteen 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 →