This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Page 1 24/12/2009 CP5520 Answer to Practice Week 6 14.14 Consider a disk with block size B=512 bytes. A block pointer is P=6 bytes long, and a record pointer is P R =7 bytes long. A file has r=30,000 EMPLOYEE records of fixed length. Each record has the following fields: NAME (30 bytes), SSN (9 bytes), DEPARTMENTCODE (9 bytes), ADDRESS (40 bytes), PHONE (9 bytes), BIRTHDATE (8 bytes), SEX (1 byte), JOBCODE (4 bytes), SALARY (4 bytes, real number). An additional byte is used as a deletion marker. a) Calculate the record size R in bytes. b) Calculate the blocking factor bfr and the number of file blocks b assuming an unspanned organization. c) Suppose the file is ordered by the key field SSN and we want to construct a primary index on SSN. Calculate 1) The index blocking factor bfr i (which is also the index fanout fo); 2) The number of firstlevel index entries and the number of firstlevel index blocks; 3) The number of levels needed if we make it into a multilevel index; 4) The total number of blocks required by the multilevel index; and 5) The number of block accesses needed to search for and retrieve a record from the filegiven its SSN valueusing the primary index. d) Suppose the file is not ordered by the key field SSN and we want to construct a secondary index on SSN. Repeat the previous exercise (part c) for the secondary index and compare with the primary index. e) Suppose the file is not ordered by the nonkey field DEPARTMENTCODE and we want to construct a secondary index on DEPARTMENTCODE using Option 3 of Section 14.1.3, with an extra level of indirection that stores record pointers. Assume there are 1000 distinct values of DEPARTMENTCODE, and that the EMPLOYEE records are evenly distributed among these values. Calculate 1) The index blocking factor bfr i (which is also the index fanout fo); 2) The number of blocks needed by the level of indirection that stores record pointers; 3) The number of firstlevel index entries and the number of firstlevel index blocks; 4) The number of levels needed if we make it a multilevel index; 5) The total number of blocks required by the multilevel index and the blocks used in the extra level of indirection; and 6) The approximate number of block accesses needed to search for and retrieve all records in the file having a specific DEPARTMENTCODE value using the index. f) Suppose the file is ordered by the nonkey field DEPARTMENTCODE and we want to construct a clustering index on DEPARTMENTCODE that uses block anchors (every new value of DEPARTMENTCODE starts at the beginning of a File: //home/vdimitrov/6184/f188b3a7d5f9467eff55f536f5d29bf539b73ad7.doc School of Information Technology, James Cook University Page 2 24/12/2009 new block). Assume there are 1000 distinct values of DEPARTMENTCODE, and that the EMPLOYEE records are evenly distributed among these values....
View
Full
Document
This note was uploaded on 12/23/2009 for the course DBST 663 taught by Professor Tba during the Spring '09 term at MD University College.
 Spring '09
 TBA

Click to edit the document details