Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 5

Data Warehousing

Need for Speed: Join Techniques

1
About Nested-Loop Join

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

Join cost = Blocks accessed for Table_A +


Blocks accessed for Table_A  Blocks accessed for Table_B

You might also like