SimuVedaSystem Design Lab Open in the lab

System design / 4 simulations

Database Internals for System Design

Database internals you can see: B-tree vs LSM tree, the write-ahead log and fsync, MVCC snapshots and vacuum, and row vs column stores.

Open the lab → Change the load, break a part, watch what happens. Free, no sign-up.

What happens inside the database

Most system design answers say put it in Postgres or use Cassandra and move on. Knowing what the database does with each write explains why: a B-tree rewrites pages in place and suits read-heavy apps, while an LSM tree turns writes into sequential files and suits heavy write loads such as logs, metrics and chat.

Durability comes from the write-ahead log. A commit is safe only once its log record is on disk, and how often the database forces that (every commit, in groups, or once a second) is a direct trade between speed and how much data a power cut can lose. MVCC lets long reports and constant writes run together by keeping old row versions, at the cost of cleanup work.

Finally, layout decides which queries are cheap. Row stores fetch one whole record fast; column stores scan a few columns over billions of rows. The simulations below show each of these trades with numbers you can change, ending with how the planner picks an index.

All topics: database internals

Other topics