File Organization
• File : It maintain the records /details about specific activity. Eg : admission file A file is a sequence of related records.
• File organization: It is a method which mention about physical arrangement of data.
• Record : It is collection of related fields.
• Fields: It is a single character or group of characters. Eg : A , rno,name
• Character : smallest element. Eg :1 ,2 ,a ,b ,&,*
Physical and Logical File
|
---|
Record Organization
A file is a collection of logically related records. Depends on length of Record :
A)Fixed –Length Records : Every record in the file is equal in size.
B)Variable –Length Records : Different records in the file do not have equal size.
Fixed length record
Advantages : 1. Accessing record is easy
2. Insertion and deletion is easy.
Disadvantages: 1. Wastage of memory
Fixed length
record |
Variable Length
Record |
Every record have
equal length |
Different length |
Access to record is fast |
Record
accessing is slow |
Memory wasted |
Memory is saved |
Insertion and deletion is easy |
Insertion and
deletion is difficult |
File Organization
Advantages :❑ Simple
❑ Space is utilized.
❑ Insertion of record is easy.
Disadvantages :❑ Searching record is slow.
❑ Cost to update record is high .
❑ Deletion create wastage of space.
2: Sorted File :
- Search Key : The field whose value determines how to insert record.
- Search key is used to arrange record in sequential order.
- Sequential or ordered file organization .
- Eg: Employee table and search key: Emp_id
3: Indexed file :
- A sequential file that is indexed is called as indexed sequential file.
- Records are sorted on disk sequentially by key value.
- Indexes are also maintained to allow direct retrieval based on key value.
- A separate file stores the data in the order of primary key value.
- Another file is maintained o store index entries .
- Two fields : key value ,pointer .
Advantages |
Disadvantages |
The desired record
can be immediately accessed |
The files have to be
recognized periodically to discard deleted records |
Faster access |
Back up required
|
Primary and
secondary indexed is used to search the data |
Extra overload of
maintaining additional DS |
4: Hashed File :
Sr |
Heap file |
Indexed file |
1 |
Searching is slow |
Searching is fast. |
2 |
No extra overload. |
Extra overload |
3 |
Not recognized periodically. |
Recognized periodically. |
4 |
Useful: data is collected prior bases. |
Useful: commercial data access. |
Heap file |
Hashed file |
Pile /serial |
Random Access file |
Data Insert: As come |
Insert: Hash function |
Search: sequentially : slow |
Searching : Direct :fast |
Insert :Append : fast |
Insert : slow |
Overhead |
Hash field: change ,overhead |
Comments
Post a Comment