Answered step by step
Verified Expert Solution
Link Copied!

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 I/Os (i.e., 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 I/Os. 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 (i.e., 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 =800 memory pages available, and suppose the following is also true of the two relations: Number of records in R =50,000 Number of pages in R =5,000 Number of records in S =120,000 Number of pages in S =15,000 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. 2.1)(6 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? 2.2)(7 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. 2.3)(7 points) Suppose we give you a new disk, and that reading a page from this disk will take 1\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 (e.g., if X =7.346 use 7.35 as your final value for X).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Time Series Databases New Ways To Store And Access Data

Authors: Ted Dunning, Ellen Friedman

1st Edition

1491914726, 978-1491914724

More Books

Students also viewed these Databases questions