1,099 views
4 4 votes
Amy and Bob are working on a project vehicle rental system, they have a file consisting of 10000 records, having block size 1024 bytes, record size 100 bytes. Search key size 9 bytes, pointer 7 bytes. They want to implement single level indexing. Bob suggested to implement 1st level index using dense index, however Amy suggested to implement sparse index. How many blocks are saved by Amy considering only 1st level index ________?

1 Answer

4 4 votes

Blocking factor of Data Blocks  =    No of records per block

                                               =   $\left \lfloor \frac{Data block size}{record size} \right \rfloor$

                                     = $\left \lfloor \frac{1024}{100} \right \rfloor$ = 10

Total no of Data Blocks              =    Total no of Records / Blocking factor

                                    =   $\left \lceil \frac{10000}{10} \right \rceil$ = 1000      

   


Amy’s implementation using Sparse Index :-   

                                           

Index entry size   =  Search key size + Pointer to the Data block in which the particular record is located                                              

                                =>  9 + 7 = 16 Bytes

 

Considering  Index Block size = Data Block size;

 

Blocking factor of Index Block =   No of index entries per block 

                                             =     $\left \lfloor \frac{Data block size}{index entry size} \right \rfloor$        

                                   =    $\left \lfloor \frac{1024}{16} \right \rfloor$ = 64

                                                  

                                       Sparse index ensures an index entry in index block for each Data block 

                                                         Total no of Index entries =  Total no of Data Blocks 

 

No of Index blocks required using Sparse implementation  =   Total no of index entries / Blocking factor of Index block

                                                                     =   $\left \lceil \frac{1000}{64} \right \rceil$ = 16  


Bob’s implementation using Dense Index :-   

 

                                 Dense index ensures an index entry in index block for each Record of all Data Blocks 

                                                         Total no of Index entries =  Total no of Records 

 

No of Index blocks required using Dense implementation  =   Total no of index entries / Blocking factor of Index block

                                                                     =   $\left \lceil \frac{10000}{64} \right \rceil$ = 157


 

No of blocks  saved by Amy considering only 1st level index  =  157 – 16

                                                                                                             =  141

                                                                

• edited by
Position:
Show:

Related questions

3 3 votes
1 1 answer
914
914 views
ashish pal asked Dec 26, 2017
914 views
" For any data file, it is possible to construct two separate dense first level indexes on different keys. "How the above statement is true ??
0 0 votes
0 0 answers
403
403 views
Vartika Rawat asked Jul 3, 2025
403 views
"Each search key value occurs only once in the DB table ⇒ implying uniqueness ⇒ implying key"And in clustering index we say that its dense index if all clusters have only...
0 0 votes
1 1 answer
554
554 views
Suryadip asked Mar 9, 2024
554 views
61 61 votes
4 4 answers
32.5k
32.5k views
admin asked Feb 15, 2023
32,523 views
Consider a database of fixed-length records, stored as an ordered file. The database has $25,000$ records, with each record being $100$ bytes, of which the primary key oc...