Slideshow:
|
(See: click here)
Let M = # available buffers;
/* -------------------------------------------
Outer loop: read M-1 block of S
------------------------------------------- */
while ( S has more data blocks )
{
read M-1 data blocks of S;
Reset R;
/* -------------------------------------------
Innerloop: read through R and compute ×
------------------------------------------- */
while ( R has more data blocks )
{
read 1 data block of R;
for ( each tuple s ∈ M-1 blocks of S and
each tuple t ∈ 1 blocks of R ) do
{
output (s, t);
}
}
}
|
M ≥ 2 buffer
|
The cost of the nested-loop cartesian product (×) algorithm is:
B(S)
Disk I/O cost = B(S) + ------- B(R)
M-1
|
See: click here