Question
a) (2 marks) Consider storing a relation R(x,y) in a grid file. Attribute x has a range of values from 0 to 100. Attribute y
a) (2 marks) Consider storing a relation R(x,y) in a grid file. Attribute x has a range of values from 0 to 100. Attribute y has a range of values from 200 to 700. The partitions for the grid file are uniformly spaced; for xthere are partitions every 5 units, at 5, 10, 15, and so on, while for y the partitions are every 50 units at 250, 300, 350, and so on. How many buckets do we have to examine to answer the range query:
SELECT * FROM R WHERE 63 < x AND x < 92 AND 395 < y AND y < 625
b) (3 marks) Suppose we store a relation R(x,y,z) in a partitioned hash table with 1024 buckets (i.e. 10-bit bucket addresses). Queries about R specify only attribute x half of the time. The remaining queries query either y or z with the queries split evenly between these attributes. Determine the average number of buckets that need to be searched to answer a query for the two following strategies. Also, answer which hash function best matches the types of queries expected.
The hash function produces 4 bits based only on x, 3 bits based only on y, and 3 bits based only on z.(1 mark)
The hash function produces 6 bits based only on x, 2 bits based only on y, and 2 bits based only on z.(1 mark)
Which strategy is better? (1 mark)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started