Indexed Sequential File Organization | Database Management System
Indexed Sequential File Organization |В Database Management System
Indexed Sequential File Organization : The retrieval of a record from a sequential file, on average, requires access to half the records in the file, making such inquiries not only inefficient but very time Consuming for large files. To improve the query response time of a sequential file, a type of indexing technique can be added.
An index is a set of y, address pairs. Indexing associates a set of objects to a set of orderable quantities, which are usually Smaller in number or their properties provide a mechanism for faster search. The purpose of indexing is to expedite the search process. Indexes created from a sequential (or sorted) set of primary keys are referred to as index sequential. Although the indices and the data blocks are held together physically, we distinguish between them logically. We shall use the term index file to describe the indexes and data file to refer to the data records. The index is usually small enough to be read into the processor memory.
A primary index is an ordered file whose records are of fixed length with two fields. The first field is of the same data types as the ordering key field of the data file, and the second field is a pointer to a disk block a block address. The ordering key field is called the primary key of the data file there is one index entry (or index record) in the index file for each block in the data file. Each index entry has the value of the primary key field for the first record in a block and a pointer to other block as its two field values. We will refer to the two field values of index entry i as K(1), P (i).
- An indexed file contains records ordered by a record key.
- Each record contains a field that contains the record key.
- The record key uniquely identifies the record and determines the sequence in which it is accessed with respect to other records.
- A record key for a record might be, for example, an employee number or an invoice number.
- An indexed file can also use alternate indexes, that is, record keys that let you access the file using a different logical arrangement of the records.
- For example, you could access the file through employee department rather than through employee number.
- The record transmission (access) modes allowed for indexed files are sequential, random or dynamic. When indexed files are read or written sequentially, the Sequence is that of the key values.
Advantages of indexed Sequential File Organization
- Quite easy to process,
- With proper selection of a key field, records in a large file can be searched and accessed in very quickly.
- Any field of the records can be used as the key. The key field can be numerical or alphanumerical.
Disadvantages of Indexed Sequential Files Organization
- Extra data Structures have to be maintained These extra data Structures maintained On the disk can use up much disk Space, especially for long key values.
- The indexed files have to be reorganized from time to get rid of deleted records and improve performance that gets gradually decreased with addition of new records.