Consider a disk with block size B = 512 bytes.
A block pointer is P = 6 bytes long, and
a record pointer is PR = 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),
Department_code (9 bytes),
Address (40 bytes),
Phone (10 bytes),
Birth_date (8 bytes),
Sex (1 byte),
Job_code (4 bytes), and
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 that the file is ordered by the key field Ssn and we want to construct a primary index on Ssn.
(i) the index blocking factor bfri (which is also the index fan-out fo);
(ii) the number of first-level index entries and the number of first-level index blocks;
(iii) the number of levels needed if we make it into a multilevel index;
(iv) the total number of blocks required by the multilevel index; and
(v) the number of block accesses needed to search for and retrieve a record from the file--given its Ssn value--using the primary index.
d) Suppose that 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.
A database is a way to store data in tabular form so that it can be accessed easily. To store tables, tools such as SQL, MYSQL, ORACLE, MSACCESS are used.
Answer and Explanation: 1
a) Length R = (30 + 9 + 9 + 40 + 9 + 8 + 1 + 4 + 4) + 1 = 115 bytes.
b) Blocking factor bfr = floor (B/R) = floor (512/115) = 4 records per block.
See full answer below.
Become a member and unlock all Study Answers
Start today. Try it nowCreate an account
Ask a question
Our experts can answer your tough homework and study questions.Ask a question Ask a question
Learn more about this topic:
fromChapter 6 / Lesson 10
Take a look into the definition of a database index, a comparison of spreadsheets and database indexes, a full-text search engine comparison, a tutorial of database index types, and some categories of database indexes.