B-Tree Indexes and How They Help
What an index actually stores and the operations it accelerates.
Why Interviewers Ask About Indexes
When an interviewer says 'this query is slow, what do you do?', the answer they are listening for almost always involves an index. Indexes are the single biggest lever on read performance, so they separate candidates who memorized syntax from those who understand how a database actually finds rows.
In this lesson you will build a precise mental model of the B-Tree index: what it stores, which operations it speeds up, and how to talk about it the way a senior engineer would.
The Problem an Index Solves
Without an index, finding rows that match a condition forces the database to read every row in the table. This is a sequential scan (or full table scan). On a million-row table, that means a million row checks even if only one row matches.
An index is a separate, sorted data structure that lets the engine jump straight to matching rows, the same way a book index lets you find a topic without reading every page.
-- No index: the engine reads ALL rows to find this one
SELECT * FROM users WHERE email = 'ada@example.com';All lessons in this course
- B-Tree Indexes and How They Help
- Composite Index Column Order
- Covering Indexes and Index-Only Scans
- When Indexes Hurt: Writes and Selectivity