CS FundamentalsHardGATE CS (PYQ pattern)

R(A, B) has 10,000 tuples with V(R, B) = 200; S(B, C) has 5,000 tuples with V(S, B) = 500 and V(S, C) = 100; T(C, D) has 2,000 tuples with V(T, C) = 400. Using the standard estimate |X join Y| = |X| |Y| / max(V(X, a), V(Y, a)) on the join attribute a, and assuming the C-values of an intermediate result keep their count from S, what is the estimated size of (R join S) join T?

  1. A. 2,000,000
  2. B. 100,000
  3. C. 250,000
  4. D. 500,000

Correct answer: D. 500,000

|R join S| = 10,000 x 5,000 / max(200, 500) = 100,000, which keeps V(C) = 100. Then 100,000 x 2,000 / max(100, 400) = 500,000. Dividing by the smaller count (100) gives 2,000,000; stopping after the first join gives 100,000.

More DBMS and SQL questions

Exams that ask this topic