Slideshow:
for ( each tuple s ∈ S ) do
{
for ( each tuple r ∈ R ) do
{
if ( r(Y) == s(Y) )
{
output (r, s);
}
}
}
|
Worst case performance:
# Disk I/O = T(S) × T(R)
|
Advantage:
|
|
|
Open( )
{
R.Open( );
S.Open( );
s = S.getNext(); // s = current tuple of S
}
|
Graphically:
|
Note:
|
getNext( ) algorithm in pseudo code:
/* ------------------------------------------------------------------
getNext( ): output the next (1 !!!) tuple in the join R ⋈ S
----------------------------------------------------------------- */
getNext( )
{
/* ==============================================================
Note:
At this point in the code,
s contains the current tuple ∈ S
|
Close( )
{
R.Close( );
S.Close( );
}
|