Fan Qi Database Lab 1, com1 #01-08 CS3223 Tutorial 6
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
Join The one with smaller size
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
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?
Join – Grace Hash Join Memory InputOutput Probing Phase
Join – Hybrid Hash Join Memory Input Memory InputOutput Partition Phase of R Partition Phase of S
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
Question 1 |S| < |R|, uniform distribution assumption
Question 1
Question 2