







Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!








Book Chapter 13.1-13.
Student(sid, name, addr, age, GPA) Enroll(sid, dept, cnum, sec) B+tree index on sid, age of Student table
(R and S example slide)
For each r in R do For each s in S do if r.C = s.C then output r,s pair
For each r in R do X <- index-lookup(S.C, r.C) For each s in X do output (r,s)
(sort-merge algorithm slide)
Cost Formula (if bR < bS ) Nested Loop Sort Merge Hash Index
22 blocks
.... (^) R 100 blocks
... (^) S 1000 blocks
Memory
...
...
Memory output (^) R
S (^) S
Memory output (^) R
S
10 blocks per table?
(naive nested-loop join algorithm slide for reminder)
(join diagram)
→ Use smaller table for the outer loop.
(hash join slide for reminder. two stages: hashing stage and join stage)
Gi .... ... R
buckets
H1 from S
5 blocks 48 blocks
G1 from R
Recursive partitioning
Q: How many disk IOs? How should we use memory?
Merge sort algorithm
R
100 blocks
R
100 blocks
22 blocks
22 blocks
? ....
sorted runs
Repeat it for S table of 1,000 blocks. Show that now we need three stages.