




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





1
2
output (R[i], S[j]);
5
Merge Join
Memory
…..
…..
R S
R S
6
Algorithm (1) Hash R tuples into G1,…,Gk buckets (2) Hash S tuples into H1,…,Hk buckets (3) For i = 1 to k do match tuples in Gi, Hi buckets
Hash Join
... ...
Memory buckets G G Gk
R
S
Gi ... ... memory Hi
R H H
G G G
(1) If not, create an index for S.C
output (r,s)
13
^ B R /( M^ −^ 2) ⋅^ BS +^ BR
14
S
…..
…..
R
S
Memory R
Merge Sort Algorithm
R
S ...
Memory
Sorted chunks
102 blocks
(How many?)
17
(2) Merge
... ... (^) chunksSorted
Memory
Sorted file
How many disk IOs for sorting? (^18)
R
R
Join?
sorted buckets
... ...
Memory buckets G G Gk
R
S
Gi ... ... memory Hi
R H H
G G G
25
2 ( _BR BS_ )log( _M_ 1 ) _MBR_ 2 +( _BR_ + _BS_ ) (^)
26
Index Join
Memory
….. …..
R (^) S
R
Index Join Algorithm
Read a block B from R
output (r,s) Repeat to the end of R
29
99 nodes (^) 100 nodes
30
Summary of cost: Block nested-loop join 5500 Merge join 1500 Sort+merge joint 7500 Hash join 4500 R1.C index 2090–