Professional Documents
Culture Documents
Data Warehousing: Need For Speed: Join Techniques
Data Warehousing: Need For Speed: Join Techniques
1
About Nested-Loop Join
2
Nested-Loop Join: Code
FOR i = 1 to N DO BEGIN /* N rows in T1 */
IF ith row of T1 qualifies THEN BEGIN
For j = 1 to M DO BEGIN /* M rows in T2 */
IF the ith row of T1 matches to jth row of T2 on join key THEN BEGIN
IF the jth row of T2 qualifies THEN BEGIN
produce output row
END
END
END
END
END
3
Nested-Loop Join: Working Example
4
Nested-Loop Join: Cost Formula
Join cost = Cost of accessing Table_A +
# of qualifying rows in Table_A Blocks of Table_B to be
scanned for each qualifying row
OR