Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fan Qi Database Lab 1, com1 #01-08 CS3223 Tutorial 6.

Similar presentations


Presentation on theme: "Fan Qi Database Lab 1, com1 #01-08 CS3223 Tutorial 6."— Presentation transcript:

1 Fan Qi fan.qi@nus.edu.sg Database Lab 1, com1 #01-08 CS3223 Tutorial 6

2 Join Aim: Computing Cartesian Product of two sets ( Table A Join Table B) Algorithms: Iteration-based Nested loop Block nested loop Index-based Index nested loop Partition-based Sort-merge join Hash join

3 Join The one with smaller size

4 Join — Index Nested Loop Join foreach tuple r in R do foreach tuple s in S do if r i == s j then add to result

5 Join – Sort Merge Join each S partition is scanned at most once during merging each tuple of R requires scanning entire S, can you construct a worse case?

6 Join – Grace Hash Join Memory InputOutput Probing Phase

7 Join – Hybrid Hash Join Memory Input Memory InputOutput Partition Phase of R Partition Phase of S

8 Join – Conditions Equality-Join, Natural-Join Index Nested Loop Join Sort-Merge Join Hash Join Nest Loop Join Inequality-join Nest Loop Join Index Nested Loop Join

9 Question 1 |S| < |R|, uniform distribution assumption

10 Question 1

11

12

13 Question 2

14


Download ppt "Fan Qi Database Lab 1, com1 #01-08 CS3223 Tutorial 6."

Similar presentations


Ads by Google