A database is software whose job is to store facts, find them quickly, and never lose them when the power fails. Everything else — tables, indexes, transactions — exists to serve those three promises. This page covers the ideas without requiring any code, and connects to how computers store data and cloud computing.
Tables, rows, and keys
Data lives in tables, one row per item and one column per attribute. A primary key uniquely identifies a row, and a foreign key points at a row in another table — an order points at a customer.
Why split into tables: storing a customer’s address on every order duplicates it and guarantees that some copies will be wrong. Normalisation stores the address once and references it.
The query planner and the index
A query says what you want, not how to get it; the planner chooses a strategy. With no index, finding one row among a million means scanning all of them. With an index on that column, it means a few reads.
The book analogy: an index is a sorted side structure. The cost is that every insert or update must also update the index, which is why databases with many indexes write more slowly.
Transactions
A transfer between two accounts must debit one and credit the other, or do neither. Wrapping both statements in a transaction gives atomicity: a crash between them rolls back rather than losing money.
Isolation: concurrent transactions must not see each other’s half-finished work. Stronger isolation costs throughput, which is why systems tune it rather than always maximising it.
Relational versus document stores
Relational databases enforce a schema and relationships up front. Document stores keep flexible JSON-like records and push structure into the application. Neither is better in general.
When documents win: rapidly changing shapes and per-item nesting. When they lose: reporting across many relationships, where joins are needed constantly.
Scaling: bigger machine or more machines
Scaling up means a stronger server; scaling out means splitting data across servers. Splitting is hard because joins and transactions assume everything is in one place.
Replication: copies on several machines allow reads to spread out and provide failover, at the cost of temporary inconsistency between replicas.
What to ask afterwards
- Why does a missing index make a search slow? (Full table scan.)
- Why not index every column? (Writes get slower and storage grows.)
- What happens to an unfinished transaction after a crash? (It is rolled back on recovery.)
- Why do analytics systems look different from order systems? (Read patterns differ; columnar storage favours scanning aggregates.)
Related: algorithms, search engines, and Tech & AI.



