Slideshow:
|
R = (X, Y)
S = (Y, Z)
S has an clustering index on Y
|
Index join:
|
while ( R ≠ EOF ) { read next block of R in buffer b; for ( each tuple t ∈ b ) do { (1) Use t(Y) to lookup in index Y of relation S: (2a) read all tuples s with s(Y)=t(Y); (2b) output t ⋈ s: } } } |
Reason: the index is clustering:
We do this for T(R) tuples in relation R.
# disk IOs = Scan R (once) + # tuples in R × # blocks of S read per tuple of R |