Exercise 6: Indexes and Join Algorithms
1. This
is the same as Figure 10.16 in the book on page 354.

Circle the pages you would need to read in order to find all entries >= key
value 15.
Number the circled pages in the order that you would read them.
2. For this question, use the figure above. Assume that the index is over an attribute called “age”.
Now, make the following assumptions:
3. Suppose
I am joining two tables A and B using the join condition A.field1 = B.field1.
Suppose that table A is already sorted into ascending order on field1.
Suppose that table B is already sorted into ascending order on field1.
a. Will
the Page-oriented nested loops join algorithm, as shown on slide 2 of lecture 6,
work any slower or any faster on these sorted tables than it would if tables A
and B were not sorted? (In other words, is the Page-oriented nested loops join
algorithm able to exploit the fact that one or both of its input tables are
sorted on the join attribute?) Explain briefly.
b. Can
you use the page-oriented nested loops algorithm to compute the cross product
of two tables A and B? Explain
briefly. (For the purpose of this
question, you can assume that A and B are not sorted.)
c. Can you use the index-nested loops algorithm to compute the cross product of two tables A and B? Explain briefly. (If you are able to use this algorithm, then explain what sort of index you would use for the table in the inner loop.)
4. Challenge question (on your own, if you want to): Devise an algorithm that calculates the DIVIDE operator, and calculate the number of I/O's your algorithm takes. (Do the DIVIDE directly – in a single operator.)