14.11. Indexed Sequential Access Method (ISAM)

The Indexed Sequential Access Method (ISAM) allows programs to directly access specific items in large data files. In addition to a data file, ISAM requires at least one index. Index files are also called key files, so the access method is also known as the Keyed Sequential Access Method (KSAM). We can create an ISAM system using just the block I/O, and random and direct access functions described previously. ISAM is easier to understand if we are familiar with the roles that each file plays in the data access.

Data FileIndex Files
  • consists of fixed-length records (instances of structures or classes)
  • each data record consists of many different fields
  • the file is very large:
    • each data record is large
    • the file contains many records
  • the file is too large to fit in memory, making it inconvenient to reorganize
  • new data records are appended to the end of the data file
  • consist of records with two fields
    • a key that duplicates a data record field
    • the index number of a data record with a field matching the key
  • index files may support a fast-search algorithm (e.g., B-trees, hashing, etc.)
  • each index file allows searching the data file on one data record field
  • implement an associative search: a search for part of the data that returns all the data
ISAM file roles and operation. An ISAM system allows a program to access data records sequentially in index file order. Additionally, programs can search for and locate specific data records quickly.
The relationship between an index and data file. The data file with three records is detailed. One field in each record is a person's name. 'Dilbert' is in record 1, 'Wally' is in record 4, and 'Alice' is in record 5. The index file records have two fields: a person's name and a data file record number. The records in the index file are arranged alphabetically by name: Alice:5, Dilbert:1, and Wally:4.
ISAM files. Records in the index file map keys to corresponding records in the data file.