Question 7 (8 marks)
Consider a relation R(a,b,c) implemented as a
multi-attribute hashed file, with the following properties:
- the file has b = 256 pages, so the least significant 8-bits of the hash values are used
- choice vector: (bit 0 is the least significant bit)
- bit 0 in the tuple hash comes from bit 0 of the hash of attribute a
- bit 1 in the tuple hash comes from bit 0 of the hash of attribute b
- bit 2 in the tuple hash comes from bit 0 of the hash of attribute c
- bit 3 in the tuple hash comes from bit 1 of the hash of attribute a
- bit 4 in the tuple hash comes from bit 2 of the hash of attribute a
- bit 5 in the tuple hash comes from bit 1 of the hash of attribute b
- bit 6 in the tuple hash comes from bit 1 of the hash of attribute c
- bit 7 in the tuple hash comes from bit 3 of the hash of attribute a
- query distribution:
- Q1: select * from R where a = k,
PQ1 = 0.3
- Q2: select * from R where b = j,
PQ2 = 0.2
- Q3: select * from R where a = k and b = j,
PQ3 = 0.2
- Q4: select * from R where b = j and c = m,
PQ4 = 0.1
- Q5: select * from R where a = k and c = m,
PQ5 = 0.2
where k, j and m are constants of the appropriate type
Based on the above, answer the following:
How many pages are accessed in answering queries of type Q1?
How many pages are accessed in answering queries of type Q2?
How many pages are accessed in answering queries of type Q3?
How many pages are accessed in answering queries of type Q4?
How many pages are accessed in answering queries of type Q5?
What is the weighted average cost of answering a query on this relation?
Instructions:
- Type your answer to this question into the file called q7.txt
- Submit via: submit q7