Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
89 views

Indexed Sequential File

Indexed sequential files improve on sequential files by maintaining an index to allow for faster random access. The index contains key-value pairs mapping search keys to record locations. This allows searching the smaller index first before accessing the specific record. Different index structures like hash indexes and tree indexes can be used to further improve search efficiency. The cylinder surface index structure sorts and stores records across disk cylinders and surfaces with indexes of the first record in each to narrow searches.

Uploaded by

Study Mail
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
89 views

Indexed Sequential File

Indexed sequential files improve on sequential files by maintaining an index to allow for faster random access. The index contains key-value pairs mapping search keys to record locations. This allows searching the smaller index first before accessing the specific record. Different index structures like hash indexes and tree indexes can be used to further improve search efficiency. The cylinder surface index structure sorts and stores records across disk cylinders and surfaces with indexes of the first record in each to narrow searches.

Uploaded by

Study Mail
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Indexed Sequential File

To overcome the shortcomings of the sequential file structures, indexed


sequential file structure is used. In this the records of the file are stored like in a
sequential file. But in addition to this, some index of the records is (are)
maintained. An index is a collection of (key_value, record_address) pairs. The
index is represented using a separate data structure. A search for a record using
a key field shall now be carried out in the index based on that key value. Once
the index entry is located, the record_address part of the entry can be used to
directly access the record. Due to smaller size of the index, it can be structured
in a way that facilitates efficient search, eg. sorted array (for binary search),
hash table, search-trees, etc. Also, for the same file several indexes using
different key field can be maintained to help search based on different key
fields. Since an index can contain many entries (as many as the number of
records in the file), structuring them appropriately to facilitate an efficient
search is important.

Some Index structures

1. Cylinder Surface Indexing - This index structure is for files stored in hard
disks. It needs the records to be sorted on some field. Then assuming a sequence
of the cylinders in the disk and a sequence of surfaces (tracks) in each cylinder,
the sorted records are stored starting from the first cylinder and proceeding in
the assumed sequence through the cylinders. An index of the first record in each
cylinder is maintained using the field on which the records are sorted as the key
field. This is the cylinder index. The key values of this index defines the ranges
of the key value present in each cylinder, so that for a search of a particular
record the cylinder in which the record may be present can be found out. So the
search for the record can be performed only in that cylinder. Again within a
cylinder, records are stored starting from the first surface and through the
assumed sequence of surfaces. Here an index of the first record in each surface
is maintained using the same key field. This is the surface index. There is a
cylinder index for the entire file and one surface index for each cylinder that the
file spreads over.

The idea of cylinder surface index can be used even without considering
cylinders and surfaces. If the records are sorted and kept in a disk file, then an
index containing the (key-value, offset) of equally spaced records records can
help a sequential search by requiring the search first in the index, and then in the
proper segment of the disk file.
2. Hash Index - In this indexing the (key_value, record_address) pairs of each
record in the file are stored in a hash table which is an array. Insertion and
search of such an index element is done using a suitable hash function and
collision resolution mechanisms. The good performance associated with
hashing can be achieved in this method, but requires selection of appropriate
hash function and collision resolution mechanisms.
3. Tree index - The basic idea in searching using any search tree is to
successively divide the searching domain (set of elements where search is to be
done), until either the search is successful or it is found that the element is not
present in the given set. An m-way search tree is a very general search tree
where the elements are ordered on a key field and m denotes the maximum
number of partitions that the set can be divided into at any level. In other words
it is the maximum number of children that each node can have. At each level the
root of the tree can contain upto m - 1 key values that define the partition
boundaries.

Advantages of Indexed sequential access file organization

 In indexed sequential access file, sequential file and random file access is
possible.
 It accesses the records very fast if the index table is properly organized.
 The records can be inserted in the middle of the file.
 It provides quick access for sequential and direct processing.
 It reduces the degree of the sequential search.

Disadvantages of Indexed sequential access file organization

 Indexed sequential access file requires unique keys and periodic


reorganization.
 Indexed sequential access file takes longer time to search the index for
the data access or retrieval.
 It requires more storage space.
 It is expensive because it requires special software.
 It is less efficient in the use of storage space as compared to other file
organizations.

You might also like