What is File Organization?
Database systems store data permanently on secondary storage devices (like hard disks) as multiple files. Think of it like organizing books in a library - we need systematic ways to store and find information quickly.
Key Points:
-
Files are organized as sequences of records
-
Records are mapped onto physical disk blocks
-
The goal is to optimize storage efficiency and access performance
Block Structure - The Foundation
What is a Block? A block is like a container that holds data. Each database file is divided into fixed-size blocks.
Block Size Examples:
-
Most databases use 4-8 KB blocks
-
Example: If you have a 4 KB block, it can hold about 4,000 characters
Two Critical Rules:
-
No record can be larger than a block
- Example: If block size is 4 KB, no single record can exceed 4 KB
-
Each record must fit entirely in one block
- A record cannot be split across two blocks
Why These Rules Matter:
-
Simplifies reading/writing data
-
Only need one disk access to get a complete record
-
Makes buffer management easier