Unit 6: Query Processing and Optimization
Unit 6: Query Processing and Optimization
E1 ⨝ E2 ≡ E2 ⨝ E1
(r1 ⨝ r2) ⨝ r3
so that we compute and store a smaller temporary relation.
Join Ordering Example (Cont.)
• Consider the expression
name, title(dept_name= “Music” (instructor) ⨝ teaches)
⨝ course_id, title (course))))
• Could compute teaches ⨝ course_id, title (course) first, and join result with
dept_name= “Music” (instructor)
but the result of the first join is likely to be a large relation.
• Only a small fraction of the university’s instructors are likely to be from
the Music department
• it is better to compute
dept_name= “Music” (instructor) ⨝ teaches
first.
THANK
YOU