
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An example of how to store data in a binary file using a student relation. The concept of tuples, block size, block header, and free space. It is an essential read for students and researchers in the field of database management and computer science.
Typology: Study notes
1 / 1
This page cannot be seen from the preview
Don't miss anything!

An example for the data file.
The data file must be stored in binary format. The following example should clarify the things.
Suppose the Relation – Student has 3 records.
Id(4 bytes) Name(5 Bytes)
1 Jones
2 John
3 Tom
4 Jim
The Id column is of size 4 bytes. The name column is of size 5 bytes ( Add an extra byte to
represent the end of char '\0' ) That makes it a total of 10 bytes per tuple.
Assume these tuples are stored randomly across data blocks within the same data file. The values
used (size of block and tuple) are for the purpose of example only. The actual values may be
different as per your implementation. The
Block Size: 32 bytes.
Block header: 2 bytes ( This stores the number of tuples in the block).
Tuple size : 10 bytes.
Note that in this example, the tuples were stored randomly across the blocks.
The block as a whole has to be read/written from/to the binary file as and when required.
Tuple
Tuple
Tuple
Block 3 begins
Block 2 begins
Block 1 begins
Block Header
Tuple stored in this block
Tuple
32 bytes long block
Free space Free space Free space