Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In class, we developed a cost model for various relational database operations, such as joins. We counted the total number of I / Os (
In class, we developed a cost model for various relational database operations, such as joins. We counted the total number of IOs ie writing or reading a disk page required to perform each operation. From there, we could estimate the relative performance of two query plans. If we were to consider a nested loop join vs a hash join, for example, we might guess that using the hash join would be better because it would require fewer IOs In modern magnetic disks, the cost of performing a sequential read is approximately the same as that of performing a sequential write; however, you might imagine another kind of secondary storage device where this is not true. For example, it is widely accepted that when using flash memory devices, it is cheaper to read a block than it is to write a block. Therefore, you might also imagine that replacing our magnetic disk with another device would affect our cost estimates, which could in turn affect the optimizers plan ie choice of algorithms For this question, suppose that you are given two relations, R and S and that you want to perform a natural join between the two. Suppose that you have B memory pages available, and suppose the following is also true of the two relations: Number of records in R Number of pages in R Number of records in S Number of pages in S Given the above information, answer the following questions. In all cases, please ignore the cost of writing the final result back to secondary storage. Please make sure to show your work for full credit. points Block Nested Loops Join Choose the outer relation such that the total cost is minimized. How many a total reads and b total writes are required? points Grace Hash Join How many a total reads and b total writes are required? Assume the relation is evenly distributed in the partitioning phase. points Suppose we give you a new disk, and that reading a page from this disk will take mu s and writing a page to disk will take X mu s Given your above analysis, for which values of X would you choose the block nested loops join? For which values of X would you choose the hash join? Round X to the nearest hundredth if necessary eg if X use as your final value for X
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