19,152 views
2 votes
2 votes
Suppose that we have an ordered file of 30,000 records and these records are stored on a disk and block size is 1024 bytes files records of fixed length and unspanned of size 100 byte and suppose that we have created a primary index on key field of size 9 bytes and a block pointer of size 6 bytes then find the average number of block access required with or without index?

1 Answer

2 votes
2 votes

Block size=1024B

Record Size=100B

No of records per block= 1024/100=10.24 but we can store only 10 records at max

No of blocks required to store 30000 records=30000/10= 3000

Without Primary Index: No of block accesses= log(3000)= 12

Size of a Index record= 9+6=15B

No of index record per block= 1024/15= 68 (unspanned)

we have already calculated no of blocks needed to store all records= 3000

so total no of index records =3000

Since, 68 index records are present in 1 block.

3000 index records will be present in 3000/68= 45 blocks.

With primary index: total no of block accesses =ceil(log(45))+1=6+1=7

 

 

 

Related questions

0 votes
0 votes
0 answers
3
aashijn asked Apr 28, 2022
1,391 views
employee (person-name, street, city)works (person-name, company-name, salary)company (company-name, city)manages (person-name, manager-name) a. Find the names of all empl...
0 votes
0 votes
0 answers
4
Mayank Gupta 3 asked Dec 16, 2018
204 views
What is the difference between primary multilevel index and B tree?