Slideshow:
|
|
|
Note:
|
minCost = Infinite; if ( R and S sorted ) { joinCost = B(R) + B(S); if ( joinCost < minCost ) { minCost = joinCost; Method = "SortJoin"; } } if ( R and S have ordered index ) { if ( Index is clustering ) joinCost = B(R) + B(S); else joinCost = T(R) + T(S); if ( joinCost < minCost ) { minCost = joinCost; Method = "ZigZag-Join"; } } if ( S has an index ) { if ( Index is clustering ) joinCost = B(R) + T(R) × B(S)/V(S,Y); else joinCost = B(R) + T(R) × T(S)/V(S,Y); if ( joinCost < minCost ) { minCost = joinCost; Method = "IndexJoin"; } } // Nested loop joinCost = B(S) + B(S)/(M-1) * B(R); if ( joinCost < minCost ) { minCost = joinCost; Method = "NestedLoop-Join"; } // Then test 1-pass, 2-pass... etc |