Join size estimate and join strategy without knowledge of primary key. (9 points
ID: 3879940 • Letter: J
Question
Join size estimate and join strategy without knowledge of primary key. (9 points) Consider three relations rl, r2 and r3, with schemas R1(ABC), R2(CDE) and R3(EF) respectively (without the knowledge of any primary keys). Assume that nl 3000, n2 4000, and nr3-20. In addition, we also know that V(C, r1) =300, V(C, r2) = 1000, VE, r2) = 40, and VE, r3) = 10. (i) Estimate the size of natural join of three relations rl x r2 Ix r3. (ii) Give an efficient strategy for computing the join. (iii) If we only consider the join of r2 and r3, w that is the estimated size ofthe result?Explanation / Answer
(i) To find the estimated size for r1 |x| r2, we need to calculate the avg. number of tuples in second relation that will join with each tuple in the first relation. Here, in this case, for r1 |x| r2, (nr2/V(c,r2))*nr1 tuples of r2 will join with each tuple in first relation. This equals = (4000/1000)*3000 = 12000 tuples.
Joining this with r3, we will have 12000*nr3/V(E,r3) which equals 12000*20/10 = 24000 tuples.
(ii) The efficient strategy for computing the join involves computing the number of tuples in r1 |x| r2 first, followed by that of r3. This is efficient, since r1 and r2 are closer in size when compared to r3. Also, if we do the other way, i.e., r2 |x| r3 first, we need to know V(C, r2 |x| r3), which isnt available in hand.
(iii) If we only consider r2 |x| r3, estimated result is (nr3/V(E,r3))*nr2 = (20/10)*4000 = 8000 tuples.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.