Question
A relation in a relational database has 1200 tuples. The attribute has integer values ranging from 6 to 20, and the attribute has integer values ranging from 1 to 20. Assume that the attributes and are independently distributed.
The estimated number of tuples in the output of is __________
Official answer and solution
- Accepted answers
- 819 to 820, or 205
- From
- Official GATE 2021 answer key
GATE accepted either range [819, 820] (based on standard independent disjunction selectivity) or 205 (which corresponds to an alternate interpretation where the condition was read as conjunction or restricted domain).
Official answer key accepts either range 819.0 to 820.0 or 205.0 to 205.0.
Solution
Calculate individual selectivities of the conditions on A and B, then use independent probability for logical OR.
Total tuples in relation is .
- Attribute has integer values ranging uniformly from 6 to 20, comprising distinct values.
- The condition covers values , which is values.
- The selectivity of is .
- Attribute has integer values ranging uniformly from 1 to 20, comprising 20 distinct values.
- The condition matches 1 value out of 20, with selectivity .
Because attributes and are independently distributed, the selectivity of the disjunction is:
The estimated number of tuples in the output is:
(Or 819 if computed with slight precision variations).
820
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2021 Computer Science and Information Technology (CS, Set-1)
- Question
- 33 of 65, printed as CS Q.23
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.