
CPSC-608 Database Systems
Fall 2008
Instructor: Dr. Jianer Chen
Office: HRBB 309B
Phone: 845-4259
Office Hours: T-TR 10:50am-12:20noon
Teaching Assistant: Yang Liu
Office: HRBB 315B
Phone: 862-4386
Office Hours: M-W 2:30pm-4:00pm (or by appointment)
Assignment # 2
(Due October 30)
1. For each of the following operations, write an iterator that implements a
one-pass algorithm for the operation: (1) set intersection, (2) bag difference,
and (3) natural join.
2. Let Rand Sbe two relations. Suppose that one of them is clustered
and the other is unclustered. Write a nested-loop algorithm for the natural
join of Rand S. Consider both the cases that the larger is clustered and
that the smaller is clustered.
3. Consider the two-pass sort-based algorithm for duplicate elimination.
Suppose that the second pass of the algorithm does not need all Mbuffers,
because there are fewer than Msublists. How might we save disk I/O’s
by using the extra buffers? Develop an algorithm for this case and give a
detailed analysis.
4. For each of the following operations, write an iterator that implements a
two-pass hash-based algorithm for the operation: (1) duplicate elimination,
(2) bag intersection, and (3) set difference.
1