0% found this document useful (0 votes)
31 views1 page

Assignment#1

The document discusses different types of indexes - primary, secondary, and clustering indexes. It provides details on how each is implemented and whether they are dense or sparse. It also includes questions about calculating record size, blocking factor, number of file blocks, and index blocking factor given specifics about a sample employee data file.

Uploaded by

Reema
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views1 page

Assignment#1

The document discusses different types of indexes - primary, secondary, and clustering indexes. It provides details on how each is implemented and whether they are dense or sparse. It also includes questions about calculating record size, blocking factor, number of file blocks, and index blocking factor given specifics about a sample employee data file.

Uploaded by

Reema
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Assignment #1

Q1. What are the differences among primary, secondary, and clustering indexes?
How do these differences affect the ways in which these indexes are implemented?
Which of the indexes are dense, and which are not?
-Primary index:
Defined on an ordered data file, data file is ordered on a key field, one index entry for each
block in the data file, nondense (sparse) index, each disk block of the data file and the keys
of its anchor record rather than for every search value
-Clustering index:
Defined on an ordered data file, data file is ordered on a non-key field which requires that the
ordering field of the data file have a distinct value for each record, nondense (sparse)
-Secondary index:
Provides secondary means of accessing a file for which some primary access already exists ,
may be on field which is a candidate key and has a unique value in every record or non-key
with duplicate values, an ordered file with two fields , dense index

Q2. 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), BIRTHDAY (8
bytes), SEX (1 bytes), 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.
R= (30 + 9 + 9+ 40 + 9 + 8 + 1 + 4 + 4) + 1 = 115 bytes
b. Calculate the blocking factor bfr and the number of file blocks b assuming an
unspanned organization.
Bfr = floor(B/R) = floor (512/115) = 4 records per block
B= ceiling (r/bfr) = (30,000/4) = 7500 blocks
c. suppose the file is ordered by the key SSN and we want to construct a primary index
on SSN. Calculate (i) the index blocking factor bfr i
(i) Index record size R i = (V SSN + P) = (9 + 6) = 15 bytes
Index blocking factor bfr i = fo = floor(B/R i ) = floor(512/15) = 34

You might also like