Question 2.1 Spatial Index Structures (10 Points)
Suppose we store a relation R(x,y) in a grid file. Both attributes have a range of values from 0 to 1000. The
partitions of this grid file happen to be uniformly spaced:
• for x there are partitions every 20 units, at 20, 40, 60, and so on,
• for y the partitions are every 50 units, at 50, 100, 150, and so on
a. How many buckets do we have to examine to answer the range query
SELECT *
FROM R
WHERE 310 < x AND x < 400 AND 520 < y AND y < 730;
b. We wish to perform a nearest-neighbor query for the point (110,205). We begin by searching the
bucket with lower-left corner at (100, 200) and upper-right corner at (120,250), and we find that the
closest point in this bucket is (115,220). What other buckets must be searched to verify that this point
is the closest?