CSC 283 · Information Systems and File Structures
Our notes
2 min readThe idea
An indexed sequential file keeps records in key order (so batch runs can read them sequentially) and adds an index so a single record can be found quickly. It combines the strengths of sequential and direct files.
Levels of index (classic ISAM on disk)
- Master (cylinder) index: the highest key on each cylinder.
- Track index (on each cylinder): the highest key on each track.
- Data area: the records in key order on the tracks.
To find key K: search the cylinder index for the first entry ≥ K, go to that cylinder, search its track index the same way, read that track and search it. Usually only two or three disk reads.
Dense and sparse indexes
- Dense index: one entry for every record.
- Sparse (non-dense) index: one entry per block (the highest or lowest key in it); the block is then searched. ISAM uses sparse indexes, so the index is small.
Worked example: sparse index size
A file of 200,000 records, 40 records per block, index entries of 12 bytes.
- Data blocks = 200,000 ÷ 40 = 5,000.
- Sparse index = 5,000 entries × 12 = 60,000 bytes (about 59 KB), small enough to hold in memory.
- A dense index would need 200,000 × 12 = 2,400,000 bytes.
Insertions and overflow
New records cannot always fit in their proper block. Classic ISAM puts them in an overflow area (on the same cylinder or a separate one) chained from the home track. As overflow grows, access slows (more chains to follow).
Ways to reduce this:
- Leave free space (distributed free space) in each block when the file is created.
- Reorganise the file periodically: read it in key order and rewrite it without overflow.
Deletions
Records are usually marked deleted and removed at the next reorganisation.
Access modes
- Sequential: read the data area in key order (following overflow chains) for batch runs.
- Random: use the index for enquiries.
- Dynamic / skip sequential: jump to a starting key, then read sequentially (all students from U2024 onwards).
Today: B-trees
Modern systems (VSAM, database indexes in MySQL and others) use B-trees and B+ trees: balanced trees of index blocks that split and merge automatically, so there is no overflow and no need for a full reorganisation. The idea is the same: a small sorted index that leads to the data in a few reads.
Exams usually ask
- Describe the structure of an indexed sequential file and how a record is found.
- Explain overflow and reorganisation.
- Compare indexed sequential with sequential and direct files.
Common mistake
Saying an index holds the records. It holds keys and addresses only; the records stay in the data area.
Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.
No reading links here yet
Our team adds free books, videos and practice for each topic, and opens every link before it goes up.