Indexed Sequential File
Indexed Sequential File
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.
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.