Databases, from the ground up#
This is the guide I wish someone had handed me before my first “design the schema” interview question. It goes from “what even is a database” to why your production Postgres instance falls over at 3am, and it tries not to skip the boring-but-important parts in between.
Each topic below is its own page. Use the menu on the left, or browse by section here.
Start here#
Strip away the buzzwords and a database is just an organized pile of information kept somewhere it won’t…
A DBMS earns its keep by doing a handful of unglamorous jobs, constantly, without you noticing. When you…
You genuinely can build a system on flat files, CSVs, JSON blobs, whatever. Plenty of small tools do…
Data models#
Picking a data model is picking which questions will be easy to ask later and which will be painful…
This gets framed as a rivalry, but it’s closer to comparing a screwdriver to a whole toolbox labeled “not”…
Under the hood#
ACID gets recited like a magic word in interviews, but each letter is answering a specific, concrete fear…
Normalization is really just “don’t write the same fact in two places.” If a customer’s address changes,…
Without an index, finding a row means the database checks every single one, a full table scan. On a table…
A transaction is a group of operations that either all succeed or all fail together, you saw the “A” in…
Once a database is spread across more than one machine, the network between those machines will eventually…
At scale#
A replica is a second copy of your database that stays in sync with the original, usually by streaming the…
Replication copies the same data everywhere. Sharding does the opposite, it splits the data itself across…
Reference#
None of these “win” outright, each was built with a specific set of trade-offs in mind, and the honest…
Key terms used throughout this guide.