• retagged by
22,009 views
57 57 votes
A data file consisting of $1,50,000$ student-records is stored on a hard disk with block size of $4096$ bytes. The data file is sorted on the primary key $\textrm{RollNo}$. The size of a record pointer for this disk is $7$ bytes. Each student-record has a candidate key attribute called $\textrm{ANum}$ of size $12$ bytes. Suppose an index file with records consisting of two fields, $\textrm{ANum}$ value and the record pointer the corresponding student record, is built and stored on the same disk. Assume that the records of data file and index file are not split across disk blocks. The number of blocks in the index file is ________

2 Answers

Best answer
92 92 votes

ANS = 698 .

Index is being built on attribute “ANum” which is Candidate Key, but Given that file is Sorted on Primary Key “Roll No”.

This indicates that The Index must a Secondary Index, (data records not being physically ordered as per the index making a dense record necessary) so “THERE SHOULD EXIST AN INDEX RECORD FOR EVERY RECORD of Original ‘Student Table’ ”.

=> Also this Line: “Assume that Records of data file and index file are not split across disc blocks”.

This indicates UNSPANNED STRATEGY.

With This Knowledge, let’s see the Data given.

→ Record Size in Index $= 12 + 7 = 19 \text{ B}$ (‘ANum’ key size + Record pointer Size), and Block Size $= 4096 \text{ B}$

→ So number of Index records in 1 Block $= \left \lfloor \frac{4096}{19} \right \rfloor= 215$ records in 1 block (Remember again, unspanned strategy).

→ So number of blocks in the Index file $= \dfrac{\text{Total Number of records}}{\text{Records per block}} = \left \lceil \dfrac{1,50,000}{215}\right \rceil = 698.$

(Recall that this is Secondary Index)

• edited by
5 5 votes

📦 Step-by-step calculation:

1. How many index records fit in one block?

⌊4096/19⌋=⌊215.5789⌋=215 records per block

2. Total number of index records?

Since each student record has a unique ANum, we need 150,000 index records.

3. Number of blocks required for index file:

⌈150000/215⌉=⌈697.674⌉=698 blocks

Answer:
Position:
Show:

Related questions

49 49 votes
7 answers 7 answers
22.1k
22.1k views
Arjun asked Feb 18, 2021
22,115 views
Consider the following statements $S1$ and $S2$ about the relational data model:$S1$: A relation scheme can have at most one foreign key.$S2$: A foreign key in a relation...
40 40 votes
2 answers 2 answers
15.1k
15.1k views
Arjun asked Feb 18, 2021
15,054 views
The relation scheme given below is used to store information about the employees of a company, where $\textsf{empId}$ is the key and $\textsf{deptId}$ indicates the depar...
33 33 votes
3 answers 3 answers
17.3k
17.3k views
Arjun asked Feb 18, 2021
17,289 views
​​​​​Let $S$ be the following schedule of operations of three transactions $T_1$, $T_2$ and $T_3$ in a relational database system:$$R_2(Y), R_1(X), R_3(Z), R_1(Y)W_1(X), ...
46 46 votes
3 answers 3 answers
16.4k
16.4k views
Arjun asked Feb 18, 2021
16,398 views
Suppose the following functional dependencies hold on a relation $U$ with attributes $P,Q,R,S$, and $T$:$P \rightarrow QR$$RS \rightarrow T$Which of the following functio...