File Structure
File Structure
Structures
Presentation By:
Abhishek Kumar Giri
23265001
Outline:
WHAT ARE FILES?
FILE STRUCTURES
FILE ORGANIZATION:
o SEQUENTIAL FILES ORGANIZATION.
o INDEXED FILE ORGANIZATION.
o DIRECT FILE ORGANIZATION.
The file size is limited by the size of memory and storage medium.
FILE STRUCTURES
*The organization of a file affects the speed and efficiency of data retrieval.*
Types of File organization
•Fast Access: Since the location of each •Hash Collisions: Two different keys may
record can be directly computed, access to hash to the same value, leading to a
records is very fast. collision. Handling these collisions can be
complex and may require additional
storage.
•Space Utilization: If the hash function
does not distribute records evenly, some
areas of storage may be heavily used while
others are underutilized.
Real life applications
Direct Access (or Hashed) File
Sequential File Organization Indexed File Organization
Organization
• Transaction Processing Systems: • Databases: Many databases use • Databases: Databases often use
In banking or any other transaction hashing for direct access to records. indexed file organization to speed
processing system, records such as This allows for quick retrieval of up data retrieval. Indexes are used
transactions are typically appended data, which is crucial for to quickly locate data without
in a sequential manner. performance. having to search every row in a
• Log Files: Log files generated by • Caching Systems: In-memory database table every time a
systems and applications often use caches like Memcached or Redis database table is accessed.
sequential file organization. Each use hashing to store and retrieve • File Systems: Some file systems
new log entry is appended at the data quickly. use indexing to speed up file
end of the file. retrieval. For example, the NTFS
file system used by Windows
creates an index of files to speed up
search operations.
How to choose file organization method
Sequential File Direct Access (Hashed)
Indexed File Organization:
Organization: File Organization:
• When the order of records is • When you need quick access to • When you need quick access to
important. specific records. records but also need to maintain
• When you need to process large • When the system performs many the order of records.
volumes of data in a batch or in a random read and write • When the system performs many
specific sequence. operations. random read operations.
• When the system performs many • When the key value of the data is • When you need to perform range
read operations that need to uniformly distributed. queries.
process the entire file or a large
portion of it.
Thank YOU!