← RGPV CS-502-CBGS DBMS June 2020 solved question paper
RGPV CS-502-CBGS | June 2020 | Q1(b) | 7 marks
Question: Discuss in detail about Primary file organization.
Answer

Primary file organization specifies how records of a relation are physically arranged in disk blocks. Since disk access is relatively expensive, the organization determines the cost of searching, inserting, deleting and scanning records. A record may be located by scanning blocks, using an ordering key or applying a hash function.
Heap organization: Records are placed in any available space, often at the end of the file. Insertion is inexpensive, but an equality search without an index may require scanning every block. It is suitable for bulk loading and workloads that frequently scan the entire relation.
Sequential (sorted) organization: Records are stored in order of a search key. This supports ordered traversal and range queries efficiently. A search can locate the relevant region using binary search on suitable block structures. Insertion and deletion may require overflow areas or reorganization to preserve order.
Hash organization: A hash function maps a search key to a bucket. For example h(k)=k mod 5 places keys 12 and 17 in bucket 2. Collisions are handled using overflow blocks or other collision-resolution methods. Equality searches are efficient on average, but range queries are not naturally supported.
Clustered organization: Related records are placed close together on disk, reducing I/O for queries that retrieve groups of related records. Maintaining clustering during frequent updates can be costly.
For a student database, a heap is appropriate for frequent inserts, sorted organization for roll-number ranges and hashing for exact roll-number lookup. Secondary indexes may be added independently of the primary arrangement. The choice depends on query patterns, update frequency, storage overhead and required response time.
| Organization | Equality search | Range search | Insertion |
|---|---|---|---|
| Heap | Scan | Scan | Easy |
| Sorted | Efficient | Efficient | Costly |
| Hash | Efficient on average | Poor | Usually easy |
Discussion
Ask a question, share your thoughts or report an error.
Sign in to participate in the discussion.
Join the discussion