What a B-Tree Index Is
Most relational databases default to the B-tree (really a B+ tree) for indexes. It is a balanced tree that keeps keys sorted, so the engine can find any row in a few page reads instead of scanning the whole table.
Why It Is Fast
- The tree stays balanced, so every leaf sits at the same depth.
- Each node holds many keys, making the tree shallow and wide.
- A handful of node reads locates any key even in a huge table.
What It Is Good At
- Equality lookups like finding one user by id.
- Range queries because keys are stored in order.
- Sorting and prefix matches that follow the key order.
A query that filters on the leftmost columns of a composite index can use it; one that filters only on a later column usually cannot.
Key idea
A B-tree keeps keys sorted and balanced, giving fast equality lookups, range scans, and ordered reads in just a few page accesses.