hw2 - INFS-760 — Spring 2010 Dr. A. Motro 23 February...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: INFS-760 — Spring 2010 Dr. A. Motro 23 February 2010 Homework No. 2: Query Processing and Optimization Solutions due 16 March. Please be neat; if possible, type your solution. Problem 1. Assume an equality selection is to be applied to a file that occupies 10,000 blocks. 1. Assume the file is stored in consecutive disk blocks, and the selection attribute is a database key. If a linear search is used, how many blocks are accessed on average ? How would your answer change if the selection attribute is not a database key? 2. Assume the file is stored in consecutive disk blocks, the file is sorted according to the search attribute, and the selection attribute is a database key. If a binary search is used, at most how many blocks are accessed? How would your answer change if the selection attribute is not a database key? 3. Assume there is a B +-tree primary index for the selection attribute whose height is 8, and the selection attribute is a database key. How many blocks are accessed? How would your answer change if the selection attribute is not a database key? 4. Assume there is a B +-tree secondary index for the selection attribute whose height is 8, and the selection attribute is a database key. How many blocks are accessed? How would your answer change if the selection attribute is not a database key? Problem 2. 1. Assume a file that occupies 10,000 blocks is sorted using external sort-merge, and the number of available memory blocks is 3. (a) How many runs are created in the initial pass? (b) How many merge passes are required? Write the general formula and evaluate it. (c) How many blocks are read or written in total? Include the write of the final output in the calculation. (d) Assume the time to read or write a block is 15 msec, how much time does the entire sort take?...
View Full Document

This note was uploaded on 03/14/2010 for the course CS 101 taught by Professor Martand during the Spring '10 term at Punjab Engineering College.

Page1 / 4

hw2 - INFS-760 — Spring 2010 Dr. A. Motro 23 February...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online