Slideshow:
R = (X, Y)
S = (Y, Z)
S has a non-clustering index on Y
|
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 S: (2a) read all tuples s with s(Y)=t(Y); (2b) output t ⋈ s: } } |
Assuming that different tuples s are stored in different blocks, we will access:
T(S) # blocks of S accessed per tuple t ∈ R = -------- blocks V(S,Y) |
# disk IOs = Scan R (once + # tuples in R × # blocks of S read per tuple of R |