Professional Documents
Culture Documents
Course Code: Comp 324 Course Name: Database Management System II Lecture 5: File Organization
Course Code: Comp 324 Course Name: Database Management System II Lecture 5: File Organization
Course Code: Comp 324 Course Name: Database Management System II Lecture 5: File Organization
Ephesians 6:1-3
6 Children, obey your parents in the Lord, for this is
right. 2 “Honor your father and mother”—which is the first
commandment with a promise— 3 “so that it may go well
with you and that you may enjoy long life on the earth.”
Lecture Outline
1. Recap on files and file organization
2. File organization
3. Types of file organization
4. Class Activity (Moodle)
Recap
• Databases are stored physically as files of records, which are
typically stored on magnetic disks.
• A page is a unit of exchange between the disk and the main
memory.
• A file is a sequence of records stored in a binary format on
external media storage.
• Two main operations executed on the files: retrieval operations
and update operations.
• Data is read into memory for information processing and written
to disk for persistent storage.
Organizing files and records on disk
Records vs Record types
• Record Type:
• A record would thus be: STUDENT (202020, “John Doe”, “Nakuru”, “dbms”,2)
Fixed-length vs variable-length records in files
• Fixed-length records are records in the file which are of the same size in bytes. Therefore, they
can easily be allocated to blocks while variable-length records are records in the file which are of
different sizes.
Reasons for the different sizes:
• Record maybe of same type, but one or more fields maybe of varying lengths e.g names of
different sizes
• Record maybe of same type, but one or more fields may be a repeating field with multiple values.
• One or more fields may be optional
• A file may contain records of different record type.
The records of a file must be allocated to disk blocks because a block is the unit of data transfer disk
and main memory.
File Organization
• File organization is a method of arranging the records in a file
when the file is stored on disk.
• Each file organization makes certain operations efficient but other
operations expensive.
• It defines how records in a file are mapped onto the disk.
• The goal of file organization is to provide the database system
with good performance.
• There are a number of commonly used file organization which
can determine how the records of a file are physically placed on
disk.
Types of file organization