Dbms Assignment Indexes by Shivanshu Mishra
Dbms Assignment Indexes by Shivanshu Mishra
Answer:
Given
Total records: 700,000
Block size: 512 bytes
Record size: 100 bytes
Ordering key size: 9 bytes
Block pointer size: 6 bytes
Unspanned records (no record spans multiple blocks)
Step 2: Calculate the total number of blocks needed for 700,000 records
Each block can store 5 records. The total number of blocks required is:
Number of blocks=
[ Total Records
][
Records per block
=
700000
5 ]=140,000 blocks
Step 4: Calculate the number of index entries that fit in one block
The block size is 512 bytes, and each index entry is 15 bytes. The number of
entries per block is:
Entrie s per block=¿
Index block s=
[ ][
Total data blocks
Entries per block
=
140000
34 ]
= 4188 index blocks
122
Level 3: ⌈ 34 ⌉ =4 blocks
4
Level 4: ⌈ 34 ⌉=1 blocks
Final Answer:
The maximum number of block accesses required to reach the block
containing the searched data item is 5.
Q2. Consider a secondary index created on the same table as in Question1.
Total number of records in the table is 700000. Size of a block is 512 bytes.
Each data record is of fixed 100 bytes in size and unspanned. Non-ordering
key which is a secondary field is of 12 bytes and block pointer size is 6 bytes.
Find the maximum number of block accesses required to reach the block that
contains the searched data item.
Answer:
Given
Total number of records = 700,000
Block size = 512 bytes
Record size = 100 bytes
Non-ordering key size (secondary field) = 12 bytes
Block pointer size = 6 bytes
Unspanned records (each block holds complete records).
Step 2: Calculate the total number of blocks needed for 700,000 records
Each block can store 5 records. The total number of blocks required is:
[
Number of blocks=
Total Records
][
Records per block
=
700000
5 ]=140,000 blocks
Index block s=
[ ][
Total data blocks
Entries per block
=
70 0000
28 ]
= 25000index blocks
893
Level 3: ⌈ 25 ⌉=32 blocks
32
Level 4: ⌈ 28 ⌉=2 blocks
2
Level 5: ⌈ 28 ⌉=1 blocks
Final Answer
The maximum number of block accesses required to reach the block
containing the searched data item is 6.