Sort-Merge Join on Example
Case 1: Join[id=stude](Student,Enrolled)
- relations are not sorted on id#
- memory buffers N=32; all runs are of length < 30
Cost |
= |
sort(S) + sort(E) + bS + bE |
|
= |
2bS(1+log31(bS/32)) + 2bE(1+log31(bE/32)) + bS + bE |
|
= |
2×1000×(1+2) + 2×2000×(1+2) + 1000 + 2000 |
|
= |
6000 + 12000 + 1000 + 2000 |
|
= |
21,000 |
|