Data Structure (2130702)

BE | Semester-3   Summer-2017 | 05/31/2017

Q3) (c)

Explain the structure of indexed sequential file.

  • An indexed sequential file is characterized by
    • Sequential organization (ordered on primary key)
    • Indexed on primary key
  • An indexed sequential file is both ordered and indexed.
  • Records are organized in sequence based on a key field, known as primary key.
  • An index to the file is added to support random access. Each record in the index file consists of two fields: a key field, which is the same as the key field in the main file.
  • Number of records in the index file is equal to the number of blocks in the main file (data file) and not equal to the number of records in the main file (data file).
  • To create a primary index on the ordered file shown in the Fig. we use the rollno field as primary key. Each entry in the index file has rollno value and a block pointer. The first three index entries are as follows.
    • <101, address of block 1>
    • <201, address of block 2>
    • <351, address of block 3>
  • Total number of entries in index is same as the number of disk blocks in the ordered data file.
  • A binary search on the index file requires very few block accesses
Q3_C_OR_Indexed_Sequencial_File