Indexed Sequential files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Each record of a file has a key field which uniquely identifies that record. An index consists of keys and addresses (physical disc locations). An indexed sequential file is a sequential file (i.e. sorted into order of a key field) which has an index. A full index to a file is one in which there is an entry for every record.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Indexed sequential files are important for applications where data needs to be accessed.....
An indexed sequential file allows fast access to a specific record. Example: A company may store details about its employees as an indexed sequential file. Sometimes the file is accessed....
An indexed sequential file can only be stored on a random
access device
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Multi-level indexes A multi-level index is one where the index is too large and so is split into a number of separate indexes. There would then be an index for these indexes! In fact, a number of different levels of index may exist.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
An example of a multi-level index. The first level of index may look like this.
Suppose we are searching for a record with key field 2354. The computer searches sequentially down the keys until it finds the first key which is greater than 2354. This would be 2500 and the computer would now need to look at .... Index 4....
A similar process,searching through the keys for one greater than 2354 shows that the computer should now look at ... Index number 13...
...and lastly index 65...
...so the record with key 2354 would be found at address 781043.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||