This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CS411 Database Systems Spring 2007 HW#3  Part 1 Solution Due: 1:55pm CST, 04/10/07 Problem 1 MergeSort Suggested reading: Chapter 11.4 Suppose we have a relation with 2.2 billion tuples and each tuple requires 300 bytes. We have a ma chine whose main memory and diskblock size (16,384 bytes) are sufficient to sort the 2 , 200 , 000 , 000 tuples using TPMMS (TwoPhase, Multiway MergeSort). Assume that no tuples are spanned over diskblocks and there is no header information in a diskblock. 1. What is the minimum size of the main memory? 2. Assuming all results are written to disk, what is the number of disk I/Os needed to sort the 2 , 200 , 000 , 000 tuples using your answer above? Answer: 1. Let N = 2 . 2 10 9 , R = 300, B = 16384, and K = the minimum number of blocks in memory. Then, the minimum size of the main memory is B K . floorleftbig B R floorrightbig K ceilingleftBig N K 1 ceilingrightBig Then, K = 6384. Therefore, the mimum size of the main memory is 104 , 595 , 456 bytes = 6384 16384. 2. The relation R needs 40 , 740 , 741 blocks (= ceilingleftbigg N B R ceilingrightbigg ) to keep 2 . 2 10 9 tuples. In the first phase, we read in each block once and write 40 , 740 , 741 new blocks. Thus, there are 81 , 481 , 482 disk I/Os in the first phase. Then, in the second phase, we also need to read in each block once and write the same number of new blocks. Therefore, in total, there are 162 , 962 , 964 blocks of disk I/0s. Grading note: 12 potints in total; 6 points for each problem Problem 2 Pointer Swizzling Suggested reading: Chapter 12.3 Suppose that the important actions related to data storage take the following times, in some arbitrary time units: Ondemand swizzling of a pointer: 30....
View
Full
Document
This note was uploaded on 09/14/2008 for the course CS 411 taught by Professor Winslett during the Spring '07 term at University of Illinois at Urbana–Champaign.
 Spring '07
 Winslett
 Sort

Click to edit the document details