CS FundamentalsHardGATE CS · Amazon/Microsoft SDE MCQ

A table has 1,000,000 rows in 10,000 blocks. A range predicate selects 20% of the rows, which are spread evenly across the table. There is an UNCLUSTERED B+ tree on the predicate column. Which plan is likely cheapest?

  1. A. The unclustered index, because it reads only the 200,000 matching rows and nothing else
  2. B. A full table scan, because the index would cost one random block read per matching row
  3. C. A hash index lookup on the same column, built on the fly
  4. D. The index for half the range and a scan for the rest

Correct answer: B. A full table scan, because the index would cost one random block read per matching row

200,000 matching rows through an unclustered index means up to 200,000 random block reads, far more than scanning all 10,000 blocks sequentially. Unclustered indexes pay off only for highly selective predicates.

More DBMS and SQL questions

Exams that ask this topic