Skip to content
CurriculumLesson 30 ยท Files
Beginner~12 min

Sequential File Organization

Sequential organization is the simplest record layout: records sit one after another in key order. It is perfect for scans and painful for random inserts.

In plain English

Sequential files are a stack of index cards in order. Finding one means flipping from the start.

By the end you will be able to

  • Explain sequential record organization.
  • Analyze search, insert, and delete costs.
  • Know which workloads fit sequential files.
  • Compare it with indexed organization.
01

Layout and search

Records are stored in key order, one after another. A sequential search reads records until it finds the key or passes the position where the key should be. Searching is O(n) in the worst case, but scanning the whole file is optimal because blocks are contiguous. This layout is ideal for reports, logs, and batch processing.

02

Insertion and deletion

Inserting a record in the middle requires shifting later records or leaving a gap. Deleting a record leaves a hole or requires compaction. Both operations can be expensive. A common compromise is to append new records to an overflow area and merge periodically.

lesson-30.osOS
keys: 10 20 30 40 50
insert 25 -> 10 20 25 30 40 50  (shift 30,40,50)
delete 30 -> 10 20 25 40 50     (shift or leave a hole)
03

When to use it

Sequential organization is best when the workload is mostly full scans, the file is written once, or the records are processed in key order. It is a poor choice for frequent random lookups and point updates.

Key takeaways

  • Records are stored in key order.
  • Sequential scan is efficient; random search is O(n).
  • Insertions and deletions can require shifting or compaction.
  • It suits batch scans and append-heavy workloads.
  • Indexed organization is better for random lookup.

Common pitfalls

  • Assuming sequential order makes random lookup fast.
  • Ignoring the cost of shifting records.
  • Forgetting that deletion can leave holes.

Kernel notes

  • Analyze search cost.
  • Explain why insertion is expensive.
  • Match sequential files to a workload.

Quick check

0 / 2 answered

1. What is the worst-case search cost in a sequential file?

2. Which workload suits a sequential file?