TechniqueFrameworkSoftware engineering
An index turns a table scan into a handful of page reads, paid for in write speed and disk
Hussein Nasser · B-tree vs B+ tree in Database Systems
The idea
A query with no index reads every row. Hussein Nasser builds up from scanning a large table to why a tree is the structure you want: a sorted structure whose nodes are pages, so that finding a row means reading a few pages from the root down rather than all of them. The cost is on the other side. Every write has to maintain the tree, and every index takes disk. The interview question of why a query is slow is usually answered by the absence of an index; the harder question, why a write is slow, is often answered by the presence of too many.
An index buys read speed with write speed and disk; add one for the query you run most and remove the ones you never use.
When it works
Database questions in engineering and data interviews, and any slow query on a desk.
When it may fail
Indexes are one lever among many, and a query that is slow for other reasons, a bad join, a missing statistic, will not be rescued by one. The plan tells you which case you have.
How to use it
Asked why a query is slow, ask for the execution plan and look for a scan. Asked why a write is slow, count the indexes the write has to maintain. Say the trade-off out loud.
Where it came from
The source’s claim
Hussein Nasser builds up from scanning a large table to why a tree is the structure you want, and what the tree costs.
What is checked
- Checked against the clip, reviewed 2026-10-16.
- The exact place in the source is located: 1:30 to 8:30.
Connected ideas
Says something similar
Consensus is agreeing on one value when any machine may crash and the network may lieAsk what a consensus protocol assumes about crashes and the network; its guarantee is only as strong as those assumptions.
Says something similar
In dynamic programming the hard part is finding the subproblem, not the memoisationFind the subproblem and the recurrence first; the implementation is mechanical once the structure is clear.
This idea appears in
The concepts it carries, and how many works in Atlas carry each one.
Put it to work on L3VLUP
Learn the idea
Practise it
More like this
- ArgumentSoftware engineeringBook
Speed and stability rise together. The trade-off is the myth
The practices that make shipping frequent are the ones that make it safe, so do not trade one for the other.
From Accelerate · Nicole Forsgren, Jez Humble and Gene Kim