Database Management System Lecture - 35 © Virtual University of Pakistan
© Virtual University of Pakistan File Organizations Sequential files provide access only in a particular sequence That does not suit many applications since it involves too much time Some mechanism for direct access is required © Virtual University of Pakistan
© Virtual University of Pakistan Direct Access FO Indexed Sequential Direct File Organization © Virtual University of Pakistan
Indexed Sequential File As the name suggests, records are stored in a sequence (generally w.r.t. PK) But index is also maintained to provide direct access © Virtual University of Pakistan
Indexed Sequential File Index is a special file, sort of a table, that lists the key value for each record and the address of the record Address may be the track no. © Virtual University of Pakistan
Indexed Sequential File In case of direct access requirement, index is accessed rather than the file itself Location of the record is obtained from index and then the record is accessed from that location © Virtual University of Pakistan
Indexed Sequential File Track 1 Track 2 S125 S130 S131 S134 S138 Track 3 S140 S143 S145 S150 S153 © Virtual University of Pakistan
Indexed Sequential File StudID Track S101 1 S104 S110 S115 S120 S125 2 S130 S131 … Index File © Virtual University of Pakistan
© Virtual University of Pakistan Dense Key Index An index that stores entry for each record One entry for each record is wastage, since within the track search has to be sequential © Virtual University of Pakistan
© Virtual University of Pakistan Nondense Index Rather than entry for every record, entry for the record with highest key value in the track is maintained Index size reduces, search also gets more efficient Pur Kaisay? © Virtual University of Pakistan
© Virtual University of Pakistan Non-Dense Index S101 S104 S110 S115 S120 Track 1 Track 2 S125 S130 S131 S134 S138 Track 3 S140 S143 S145 S150 S153 HK on Track Track S120 1 S138 2 S153 3 …. © Virtual University of Pakistan …
© Virtual University of Pakistan Overflow in Tracks S101 S104 S110 S115 S120 Track 1 Track 2 S125 S130 S131 S134 S138 Track 3 S140 S143 S145 S150 S153 © Virtual University of Pakistan
© Virtual University of Pakistan Overflow in Tracks S101 S104 S110 S115 blank Track 1 Track 2 S120 S125 S130 S131 Track 3 S134 S138 S140 S143 © Virtual University of Pakistan
© Virtual University of Pakistan Overflow in Tracks S101 S104 S110 S115 blank Track 1 Track 2 S120 S125 S130 S131 Track 3 S134 S138 S140 S143 S101 S104 S108 S110 S115 Track 1 Track 2 S120 S125 S130 S131 blank Track 3 S134 S138 S140 S143 © Virtual University of Pakistan
© Virtual University of Pakistan Overflow Area S101 S103 S104 S109 S110 Track 1 Track 2 S118 S120 S125 S127 S128 Track 3 S132 S134 S135 S138 S140 Overflow Area S115 S130 5 S112 1 S143 S131 © Virtual University of Pakistan
© Virtual University of Pakistan Extended Index S101 S103 S104 S109 S110 Track 1 Track 2 S118 S120 S125 S127 S128 Track 3 S132 S134 S135 S138 S140 S115 S130 5 S112 1 S143 S131 Track HK in Track HK in Overflow Pointer to First Overflow 1 2 3 …… S110 S128 S140 S115 S131 S143 Address of S112 Address of S130 Address of S143 © Virtual University of Pakistan
Cylinder Index(not shown) Searching among track indexes can further be improved by introducing the Cylinder Index Entry contains the highest key in the cylinder, saves time and effort © Virtual University of Pakistan
Indexed Sequential: Summarized (not shown) Records stored in sequence, index maintained Dense and nondense types of indexes Track overflow and file overflow areas Cylinder index increases efficiency © Virtual University of Pakistan
Database Management System Lecture - 35 © Virtual University of Pakistan