CS FundamentalsHardProduct company interview · GATE level

A B+ tree index on a column is said to have a 'fan-out' of 100 (each internal node has up to 100 children). For a table with 10,000,000 rows, assuming a fully packed tree and leaves that each reference about 100 records, approximately how many levels (height) does the tree need, INCLUDING the leaf level?

  1. A. About 100 levels
  2. B. About 10,000,000 levels
  3. C. About 2 levels
  4. D. About 4 levels

Correct answer: D. About 4 levels

Leaves hold about 10,000,000 / 100 = 100,000 leaf entries worth of groups... more precisely: leaf level needs about 100,000 leaf nodes (10,000,000 records / 100 per leaf). Each level up reduces the node count by a factor of 100 (the fan-out): 100,000 → 1,000 → 10 → 1 (root). That is 4 levels above the records conceptually, i.e. about 4 levels total including the leaf level (leaf, then 3 levels of internal nodes up to the root) — consistent with the well-known rule that B+ trees stay very shallow (3-4 levels) even for huge tables.

More DBMS and SQL questions

Exams that ask this topic