























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!
























Another helpful primitive.
Main idea to join relations R and S :
for each tuple s in S do for each tuple r in R do if r and s match then ouput the join of r and s
How to optimize this?
8
Intersection and Difference Using
Sorting
a tuple is output
times it appears in R and S
buffers for R and S
initialize M-1 buckets with M-1 empty buffers
for each block b of relation R do read block b into the Mth buffer for each tuple t in b do if the buffer for bucket h(t) is full then copy the buffer to disk initialize a new empty block in that buffer copy t to the buffer for bucket h(t)
for each bucket do if the buffer for this bucket is not empty then write the buffer to disk