Find it with an index
Sorted makes it fast
An index keeps its values in order. So instead of reading every name, a search can look at one in the middle and keep only the half that could hold the name it wants.
Each look rules out a whole side.
Try it
Find Remy
These 16 player names are sorted, like an index. Tap a name to look at it. Each look rules out the names on the wrong side. Find Remy in as few looks as you can.
Quick check
Remy comes after Ivo in the sorted list. Which names can the search skip?
- Ivo and every name before it
- Every name after Ivo
- None: it still has to check them all
Show the answer
Ivo and every name before it
The list is sorted, so nothing before Ivo can be Remy. One look removes that whole side.
Halving adds up
Looking at the middle each time finds any of 16 names in at most 5 looks. A million names takes at most 20. Reading one by one could take a million.
That is why a lookup on an indexed column hardly slows down as a table grows from thousands of rows to millions.
Quick check
With an index, finding one player among a million takes a million times longer than finding one among one.
- True
- False
Show the answer
False
Each look halves what is left, so a million needs about 20 looks, not a million.
Real indexes take bigger steps
A database index is a search tree where each step has many branches, not two, so each step rules out far more than half. That is what PostgreSQL means by walking "a few levels deep into a search tree".
Read the plan
1Seq Scan on players2 Filter: (name = 'Remy')3 Rows: 2,000,000
What does Seq Scan tell Remy?
- The database reads every row: there is no usable index on name
- The query used an index
- The table is empty
Show the answer
The database reads every row: there is no usable index on name
Seq Scan means a sequential scan, every row in order. An index on name would turn it into an Index Scan.
On the studio board
The studio adds a decision to the board:
Every query a player waits for has an index. Each slow query's EXPLAIN plan is read in review.
Bolt says: Next: transactions, all or nothing.
Fact-checked 12 October 2026
- PostgreSQL: Indexes, introduction postgresql.org
- PostgreSQL: Using EXPLAIN postgresql.org