23,986 views
2 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

4 4 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

 

 

 

Position:
Show:

Related questions

1 1 vote
0 0 answers
1.0k
1.0k views
Tendua asked Nov 24, 2016
1,007 views
I have read this. -Clustered index are those in which data is arranged on fields so that it act as an index. like the phonebook. And in non-clustered index we make a new...
7 7 votes
1 1 answer
251
251 views
GO Classes asked Sep 5
251 views
Consider the following schema:$\text{Parent(pid ~INTEGER ~PRIMARY KEY)}$$\text{Child(cid ~INTEGER, ~pid ~INTEGER,}$$\text{PRIMARY KEY(cid,~pid),}$$\text{FOREIGN KEY(pid) ...
0 0 votes
1 1 answer
25.0k
25.0k views
Vedant23 asked Apr 28, 2022
25,024 views
Give an expression in the relational algebra to express each of the following queries:employee (person-name, street, city) works (person-name, company-name, salary) compa...