← all subjects

Databases

Almost every serious application is, underneath, a database with a user interface bolted on. Get the data layer right and everything above it gets simpler.

FIG_002
Relations, joined by keys.

A table is just a set of rows, but the relational model's power is that you say what you want, not how to get it — and a query optimizer, every time, works out the how.

Master that and you stop writing loops to do what one statement can. Describe the result, and the engine chooses the joins, the order, and the indexes for you.

FIG_003
1229·3 818 2435 41
Indexes make lookups fast.

Indexes are the reason it works at scale. A B-tree turns a full scan of a billion rows into a handful of pointer-follows — the same idea that makes a lookup in a dictionary instant.

Underneath, indexes, query planners, and storage engines race to answer those queries quickly — the difference between a query that returns instantly and one that times out.

FIG_004
BEGINCOMMIT
Transactions keep data correct.
FIG_001
query“café”vectorembedding spaceespressolattebistrocometgalaxycosmosviolinguitarpianoharborriveranchortractorharvestenginewheatcafék = 3 nearest[ VECTOR SEARCH ]
A vector database: text becomes points in space, and search finds the nearest neighbors.

Joins are where the model earns its name: keys stitch separate relations back together, so the same fact lives in one place and every query that needs it finds it there.

FIG_005
keysk=17k=42k=8k=23k=5k=31hashk%3shard A0 rowsshard B0 rowsshard C0 rows
Sharding: one big table split across nodes by key.

And when many users hit the same data at once, transactions keep it correct. Concurrency and recovery are what let you trust the number in the account is right — even when everything fails at the worst possible moment.

It all has to survive failure. Write-ahead logs, isolation levels, and two-phase commit are the unglamorous machinery that lets a bank trust its own numbers when the power dies mid-transaction.

Coming soonNotes for this subject are in progress — check back later.

***

| STUDY · NOTES |

A reference for the ideas behind computer science.

Written and illustrated by Amittai Siavava.

| § 2026 |