Presentation is loading. Please wait.

Presentation is loading. Please wait.

13.5 Arranging data on disk Meghna Jain ID-205CS257 ‏Prof: Dr. T.Y.Lin.

Similar presentations


Presentation on theme: "13.5 Arranging data on disk Meghna Jain ID-205CS257 ‏Prof: Dr. T.Y.Lin."— Presentation transcript:

1 13.5 Arranging data on disk Meghna Jain ID-205CS257 ‏Prof: Dr. T.Y.Lin

2 Basics Data elements are represented as records Data elements are represented as records Records stores in consecutive bytes in same disk block. Records stores in consecutive bytes in same disk block. Basic layout techniques of storing data : Basic layout techniques of storing data : – Fixed-Length Records Allocation criteria - data should start at word boundary. Allocation criteria - data should start at word boundary. Fixed Length record header Fixed Length record header – A pointer to record schema. – The length of the record. – Timestamps to indicate last modified or last read.

3 Example Example CREATE TABLE employee( name CHAR(30) PRIMARY KEY, address VARCHAR(255), gender CHAR(1), birthdate DATE ); Data should start at word boundary and contain header and four fields name, address, gender and birthdate.

4 Packing Fixed-Length Records into Blocks : Records are stored in the form of blocks on the disk and they move into main memory when we need to update or access them. A block header is written first, and it is followed by series of blocks.

5 Block header contains the following information : Links to one or more blocks that are part of a network of blocks. Links to one or more blocks that are part of a network of blocks. Information about the role played by this block in such a network. Information about the role played by this block in such a network. Information about the relation, the tuples in this block belong to. Information about the relation, the tuples in this block belong to. A "directory" giving the offset of each record in the block. A "directory" giving the offset of each record in the block. Time stamp(s) to indicate time of the block's last modification and/or access. Time stamp(s) to indicate time of the block's last modification and/or access.

6 Example Along with the header we can pack as many record as we can in one block as shown in the figure and remaining space will be unused.


Download ppt "13.5 Arranging data on disk Meghna Jain ID-205CS257 ‏Prof: Dr. T.Y.Lin."

Similar presentations


Ads by Google