- Sequential file can be searched effectively on ordering key. When it is necessary to search for a record on the basis of some other attribute than the ordering key field, sequential file representation is inadequate.
- Multiple indexes can be maintained for each type of field used for searching. Thus, indexing provides much better flexibility.
- An index file usually requires less storage space than the main file. A binary search on sequential file will require accessing of more blocks. This can be explained with the help of the following example. Consider the example of a sequential file with r = 1024 records of fixed length with record size R = 128 bytes stored on disk with block size B = 2048 bytes.
- Number of blocks required to store the file =
- Number of block accesses for searching a record = log264= 6
- Suppose, we want to construct an index on a key field that is V = 4 bytes long and the block pointer is P = 4 bytes long.
- A record of an index file is of the form <V;, Pj> and it will need 8 bytes per entry.
- Total Number of index entries = 1024
- Number of blocks b' required to store the file =
- Number of block accesses for searching a record = log24= 2
- With indexing, new records can be added at the end of the main file. It will not require movement of records as in the case of sequential file. Updation of index file requires fewer block accesses compare to sequential file
Download the Android app to get all Government Job Notifications on your Mobile.
Download Now
Download Now
Important: Please always Check and Confirm the above details with the official Advertisement / Notification.