Slideshow:
|
Graphically: (this is the TPMMS algorithm)
|
The sort-join Algorithm:
Read R until all tuples with 1st join value
are stored in memory buffers;
Read the first block of S;
While ( R ≠ empty OR S ≠ empty )
{
Let r = the current smallest join value ∈ R
Let S = the current smallest join value ∈ S
if ( r < s )
{
Situation:
skip all tuples with join attr y1 in R;
}
else if ( s < r )
{
skip all tuples with join attr y1 in S;
}
else /* r = s = y1 */
{ /* ===================================================
Join on join value r = s = y1
=================================================== */
read S as long as join attr = s (= y1);
Join tuples in S with join attr = y1;
When done:
reuse buffers;
Read R until all tuples with next smallest join value
are stored in memory buffers;
}
}
|
|
Note:
|
|
|
Fact:
|