Skip to main content
PProfileMatch
← Path

Database Indexing · Database Indexing: How a B-Tree Index Speeds Up Lookups

0 XP
  1. 1 current stop: learning
  2. 2 upcoming
  3. 3 upcoming
  4. 4 upcoming
  5. 5 upcoming

Finish after stop 5

Stop 1 of 5 · Library basement: shelves of boxes

Trick to keep in mind+3 XP

Count the trips to the shelf, not the glances at the page.

A database fetches data in fixed-size pages, each holding many rows. Once a page is in memory, checking the values on it costs almost nothing. The slow, costly step is bringing another page in from disk. So when you judge a query, ask how many pages it must fetch; an index pays off by shrinking that number.

Read it once, then a question tests whether the trick stuck.