Example on Primary Indexing (DBMS)

Suppose that we have an ordered file with r = 30,000 records stored on a disk with block size B = 1024 bytes. File records are of fixed size and are unspanned, with record length R = 100 bytes. And suppose that we have created a primary index on the key field of the file of size 9 bytes and a block pointer of size 6 bytes, then Find the average number of blocks to search for a record using without index ?

Answer

Given,

Records = 30000

Block size = 1024 bytes

Record size = 100 bytes

Key + Pointer = 6+ 9 = 15 B

 

Now, data records that can fit in one block = 1024/100 = 10.24 = 10 (approx.)

Total records = 30000

Therefore,

1 block ------------------------------------> 10 records

10 records --------------------------------> 1 block

30000 records --------------------------> 30000/10 blocks = 3000 blocks

 

hence, Block Acess = ceil ( \(log_23000\) ) = 12 block accesses

0Comment