Sequential File Organization / Ordered File Organization / Sorted File Organization / Advantages and Disadvantages
Sequential File Organization (Sorted file organization)
How do we insert a record?
- Insert the record at the end of file.
- Find the previous record on the sorting key value and reset the pointer of that record to point to the new record, and insert the previous record’s pointer in the pointer field of new record.
- All the other records’ pointers should be altered as well.
- Reorganize all the records periodically to arrange the records in the sorting order of the ordering attribute.
How to delete a record?
- Locate the record that is to be deleted.
- Replace the previous record’s pointer value with the pointer of the record to be deleted.
- Update all the other records' pointers (if needed).
- Retrieval of records become efficient if the query uses the sorting attribute as the search key.
- Sorting of records on the ordering field is fast. [No sorting is required externally]
- Insertion and deletion of records are expensive.
- Updating the sorting attribute values of the records is also expensive.
- Retrieval of records on the non-ordering attributes is not easy.