CS157b
Chris Pollett
Feb 28, 2018
Recall `M =` number of memory blocks; `B(T)` = number of blocks in table `T`.
R(A, B, C) | ||
---|---|---|
a1 | b1 | c1 |
a2 | b2 | c1 |
a2 | b3 | c2 |
S(C, D, E) | ||
---|---|---|
c1 | d1 | e2 |
c2 | d1 | e3 |
For each s in S do For each r in R do if r and s join make a tuple t then output t;
For each M-1 blocks of S do begin Read these blocks into main-memory buffers; Organize their tuples into a structure whose search attributes are the common attributes of R and S; For each block b of R do begin For each tuple t of b do begin find the tuples of S in main memory that join with t; output the join of t with each of these tuples; end; end; end;
Given `R` we sort `R` and output distinct values.