Leonard D. Shapiro
North Dakota State University
Scribe: Zuyu Zhang
for r in R
for s in S
if r.a = s.b
output <r, s>.
for each page of R
scan S, comparing each s tuple to all r tuples in the current page.
if r.a = s.b
output <r, s>.
for each block of R
scan S, comparing each s tuple to all r tuples in the current block.
if r.a = s.b
output <r, s>.
sort R on R.a.
sort S on S.b.
merge sorted R * S, join and output <r, s>.
for each r in R
lookup r.a in the index on S.b.
find all matches, output <r, s>.
scan R, partitioning it into R1, R2, ..., Rn by hashing the joining attribute via h1.
scan S, partitioning it into S1, S2, ..., Sn by hashing via h1.
for i = 1 to n do
Ri⋈ Si.
Ri⋈ Si:
pick n such that Ri's fit in memory, build a hash table on R.a via h2.
for i = 1 to n
read Ri into memory and build the hash table.
scan Si sequentially, joining with Ri by probing the hash table with the matching hash value.
1) scan the smaller relation. If the current tuple hashes to current bucket, then install it in an in-memory hash table; otherwise write to disk.
2) scan the other relation. If the current tuple hashes to the current bucket, probe the hash table for a match; otherwise write to disk.
3) repeat until done.
partition R into R1, R2, ..., Rn on disk.
partition S into S1, S2, ..., Sn on disk.
for i = 1 to n do
read Ri, build an in-memory hash table.
read Si, probe the above hash table.
scan R, leaving R0 in memory, writing R1, ..., Rn to separate files.
scan S, probing S0 into R0, leaving S1, ..., Sn on disk.
for i = 2 to n do
read Ri into memory, build an in-memory hash table.
scan Si, probing the above hash table.
({R} + {S}) * hash + // partition cost
({R} + {S}) * (1 - q) * move + // move to output buffers
({R} + {S}) * (1 - q) * I/O + // write to disk
({R} + {S}) * (1 - q) * I/O + // read into memory
({R} + {S}) * (1 - q) * hash + // build & probe 2-n passes
{R} * move + // move tuples to hash tuples for R
{S} * comp * F // probe each tuple in S; more than one comparison
start scanning R & S concurrently
when a tuple r ∈ R arrives,
probe the hash table on S, looking for answers.
insert in R hash table.
when a tuple s ∈ S arrives,
probe the hash table in R, looking for answers.
insert in S hash table.