CS FundamentalsVery hardGATE CS (PYQ pattern)

Relations R (1000 tuples), S (2000), T (500). Join selectivities: R–S 0.001, S–T 0.01, R–T 0.0005 (fraction of the cross product that qualifies). A left-deep plan joins two relations first and then the third; the cost of a plan is the size of its first (intermediate) result. What is the smallest intermediate result size over all choices of the first pair?

  1. A. 10000
  2. B. 250
  3. C. 2000
  4. D. 5000

Correct answer: B. 250

First joins: R⋈S = 1000 x 2000 x 0.001 = 2000; S⋈T = 2000 x 500 x 0.01 = 10000; R⋈T = 1000 x 500 x 0.0005 = 250. The smallest is 250.

More DBMS and SQL questions

Exams that ask this topic