Slideshow:
Problem description:
Find the best algorithm to execute ⋈1 and ⋈2 for M = 101 - click to pull out
Simplified Problem :
Solution method: brute force search for the min. cost algorithms that can operate with M = 101
Step 1: check if we can use a 1-pass algorithm for ⋈1:
Step 2: check if we can use a 2-pass (hashing based) algorithm for ⋈1:
Next, we find the best algorithm for ⋈2 (considering the buffer utilization of ⋈1 !)
Determining the buffer utilization by the ⋈1 execution:
(⋈2 is inactive and will not use any buffers)
Determining the buffer utilization by the ⋈1 execution:
Next: we run pass 2 of the 2-pass (hashing-based) algorithm (= a 1-pass algorithm on each Ri and Si)
Determining the buffer utilization by the ⋈1 execution:
Note: pass 2 is run for every chunk Ri and Si and pass 2 will output tuples to ⋈2 (→ becomes active !)
Cost (so far):
Click on image to pull out (keep running cost)
Next: determine the best suitable join algorithm for ⋈2
Prelude to considering the implementation algorithm for ⋈2:
⋈1 is actively using its buffers to produce tuples for ⋈2:
I.e.: we must find the best algorithm for ⋈2 using M = 101 − 51 = 50 buffers !!
Step 3: check if we can use a 1-pass algorithm for ⋈2:
Therefore: we cannot use the 1-pass join algorithm
Step 4: check if we can use a 2-pass (hashing based) algorithm for ⋈2:
Note: B(R⋈1S) ≤ 5000. Therfore: B(R⋈1S)/50 ≤ 100 (each chunk of the first relation of ⋈2 ≤ 100 blks)
Comment: due to buffer recycling we cannot test for remaining 50 buffer ≥ sqrt( B(R⋈2S) )
Step 4: check if we can use a 2-pass (hashing based) algorithm for ⋈2:
(This is the buffer recylcing step that I referred to in the last slide....)
Step 4: check if we can use a 2-pass (hashing based) algorithm for ⋈2:
(Because otherwise, the tuples with the same join key will be hashed into a different bucket....)
Step 4: check if we can use a 2-pass (hashing based) algorithm for ⋈2:
Cost analysis: