CS FundamentalsHardGATE CS

R has 2000 tuples with 100 distinct values of attribute b; S has 5000 tuples with 250 distinct values of b. Assuming uniform values and that the smaller set of b-values is contained in the larger, what is the optimiser's estimate of |R ⋈ S| on b?

  1. A. 100,000
  2. B. 28,571
  3. C. 400
  4. D. 40,000

Correct answer: D. 40,000

The standard estimate is |R| × |S| / max(V(R, b), V(S, b)) = 2000 × 5000 / 250 = 40,000: each R tuple meets 5000 / 250 = 20 S tuples. Dividing by the smaller count (100) overestimates, and 400 divides by the product of the two counts.

More DBMS and SQL questions

Exams that ask this topic