Query Processing
Example
Join
A B
Why do we not count the output cost?
Assume: Equal number
of students in each
course
Calculations
• Number of enrollments = 60,000*10
• Number of courses = 100
• Average number of students in a course = 6000
• Number of pages with CS4320 = 60
Note: Each of CS4320 entry can be present in a different page
This means we may have to visit 6000 pages to access all CS4320 entries
Outer loop Inner loop
Join
A B
Outer loop Inner loop
Join
A B
Total cost = 1
Outer loop Inner loop
Join
A B
Total cost = 2
Outer loop Inner loop
A B
Total cost = 3
Outer loop Inner loop
A B
Total cost = 4
Outer loop Inner loop
A B
Total cost = 4 + Same cost for page 2 of A and page 3 of A
Tuple cost is not counted here