In this article, you will learn sequential file organization in DBMS. This is one of the easiest method of file organization. In this method, files (records) are stored in a sequential manner, one after another.
There are two ways to do sequential file organization:
- Pile File Method
- Sorted File Method
1. Pile File Method
In Pile File method one record is inserted after another record and the new record is always inserted at the end of the file.
If any record needs to be deleted, it gets searched in the memory block and once it is deleted a new record can be written on the freed memory block.
The following diagram shows a File that is being organized using Pile File method, as you can see the records are not sorted and inserted in first come first serve basis. If you want to organize the data in such a way that it gets sorted after insertion then use the sorted file method, which is discussed in next section.
Inserting a new record in file using Pile File method
Here we are demonstrating the insertion of a new record
R3 in a already present file using Pile File method. Since this method of sequential organization just adds the new record at the end of file, the new record
R3 gets added at the end of the file, as shown in the following diagram.
2. Sorted file Method
In sorted file method, a new record is inserted at the end of the file and then all the records are sorted to adjust the position of the newly added record.
You can see in the following diagram that records appear in sorted order when the file is organized using sorted file method.
In case of a record updation, once the update is complete, the whole file gets sorted again to change the position of updated record in the file.
The sorting can be either ascending or descending, in this diagram the records are sorted in ascending order.
Inserting a new record in file using Sorted File Method
In the following diagram, a new record
R3 is added to an existing file. Although the record is added at the end, its position gets changed after insertion. The whole file gets sorted after addition of the new record and the new record
R3, is placed just after record
R1 as the file is sorted in ascending order using sorted file method of sequential file organization.
Advantages of Sequential File Organization
- It is simple to adapt method. The implementation is simple compared to other file organization methods.
- It is fast and efficient when we are dealing with huge amount of data.
- This method of file organization is mostly used for generating various reports and performing statistical operations on data.
- Data can be stored on a cheap storage devices.
Disadvantages of Sequential File Organization
- Sorting the file takes extra time and it requires additional storage for sorting operation.
- Searching a record is time consuming process in sequential file organization as the records are searched in a sequential order.
Leave a Reply