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?
- A. 100,000
- B. 28,571
- C. 400
- 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
- Table Bill(id, cust, region, amt) rows: (1, 'Kavi', 'E', 300), (2, 'Lata', 'W', NULL), (3, 'Kavi', 'E', 450), (4, 'Mona', 'W', 300), (5…
- Table Bill(id, cust, region, amt) rows: (1, 'Kavi', 'E', 300), (2, 'Lata', 'W', NULL), (3, 'Kavi', 'E', 450), (4, 'Mona', 'W', 300), (5…
- Table Bill(id, cust, region, amt) rows: (1, 'Kavi', 'E', 300), (2, 'Lata', 'W', NULL), (3, 'Kavi', 'E', 450), (4, 'Mona', 'W', 300), (5…
- Table Bill(id, cust, region, amt) rows: (1, 'Kavi', 'E', 300), (2, 'Lata', 'W', NULL), (3, 'Kavi', 'E', 450), (4, 'Mona', 'W', 300), (5…
- Table Bill(id, cust, region, amt) rows: (1, 'Kavi', 'E', 300), (2, 'Lata', 'W', NULL), (3, 'Kavi', 'E', 450), (4, 'Mona', 'W', 300), (5…
- Table Bill(id, cust, region, amt) rows: (1, 'Kavi', 'E', 300), (2, 'Lata', 'W', NULL), (3, 'Kavi', 'E', 450), (4, 'Mona', 'W', 300), (5…