Persistence · 7 nodes
How a database keeps your data
How a database actually keeps your data, in the order that makes each step explain the next. Seven steps from a row on a page to a deadlock in production.
Is this path right for me?
Nothing is tracked and nothing is locked — the map exists so you can see where an article sits.
-
Pages, heaps and tuples
See what a database row physically is on disk, what happens when an update no longer fits its page, and why that single fact explains half of table bloat.
- Row layout on a page
- Overflow and TOAST
-
The write-ahead log
See why the log commits before the data file does, so a crash mid-write costs you a replay instead of a corrupted table and a very bad on-call night.
- fsync and durability
- Checkpoints
-
B-Tree vs LSM-Tree
Take the B-tree when reads must stay predictable and the LSM-tree when writes outrun where you can place them — one bill now, one bill later, your choice.
- Page splits
- Compaction strategies
-
OLTP vs OLAP
Tell the two workloads apart by what they are judged on, so you stop trying to make one schema serve a checkout and a year-end report at once.
- Row vs column storage
- Why one schema cannot serve both
-
Why your index is not being used
Find the exact row count where Postgres stops trusting your index, fix the statistics instead of forcing a plan, and stop guessing why the query slowed down.
- Statistics and histograms
- Sargable predicates
-
Isolation levels
Stop treating isolation levels as a safety dial and start treating them as a list of anomalies you have agreed to tolerate, so surprises stop being surprises.
- MVCC snapshots
- Phantom reads
-
Deadlocks, seen
Watch two transactions grab the same two locks in opposite order, so the next deadlock in your logs reads as a diagram instead of an unreadable stack trace.
- Lock wait graphs
- Retry policy