GATE / CS ARCHIVE

GATE CSE 2021 SET 1 / QUESTION 23

GATE CSE 2021 Set 1 Q23

Database Management Systems · Indexing, Storage & Query Processing · Full GATE CSE 2021 Set 1 paper

GATE 2021 Set 1, Q23 1 mark · NAT
Report issue

Indexing, Storage & Query Processing

Question 23, GATE 2021: A database relation r(A,B) is stated to contain 1200 tuples. A takes integer values 6 through 20 and B values 1 through 20; A and B are independently distributed. Estimate the output count of σ[(A>10) OR (B=18)](r). The source does not explicitly assume uniform distributions and its tuple count exceeds the distinct-pair domain size.
Tap to enlarge
Answer & solution

Official answer: 819 to 820 OR 205

Our answer: 820 under uniform bag estimation; official also accepts 205

Under uniform independent attribute estimates, P(A>10)=10/15 and P(B=18)=1/20. Inclusion-exclusion gives selection fraction 10/15+1/20−(10/15)(1/20)=41/60. Multiplying by 1200 gives 820. The official key also accepts 205, which is the number of distinct qualifying pairs in the full 15×20 value grid: 200 pairs with A>10 plus 5 additional pairs with B=18. Both official alternatives are preserved exactly. Premise issues: independence alone does not imply uniform marginals, and a mathematical set relation with only these two finite-domain attributes can have at most 300 distinct tuples, not 1200. The820 estimate therefore uses bag/count statistics and uniformity assumptions; 205 corresponds to the distinct-pair grid, not 1200 distinct source tuples.

There are 15 A-values and 20 B-values. Ten A-values (11 through 20) pass A>10, while one B-value passes B=18. The overlap must be subtracted because OR counts a tuple satisfying both only once. Under the full-grid model there are 10×20+15×1−10×1=205 qualifying pairs out of 300, so the selectivity is 205/300=41/60. Applying that fraction to the stated 1200 rows yields 820. These are distinct interpretations, not two different arithmetic roundings of one count.

Original paper, page 21 · Answer key