lec05.468 - Spring 2008 CSC 468 DBMS Implementation...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
. . Spring 2008 CSC 468: DBMS Implementation Alexander Dekhtyar . . Maintenance of Data Stored on Disk Data Organization in a File Individual records can be organized in a number of different ways in the database file. Heap File Organization. Heap File denotes a record organization method where records are stored on disk pages on first-come — first-serve basis, in no particular order. That is, any record can be placed anywhere in the file, subject to space availability. Sequential File Organization. A search key is defined for the relation, and records are stored ordered according to the search key. Note that the search key need not be a primary key, or even a superkey of the relation being stored. New records must be inserted according to their search key value. Hashing File Organization. Records are hashed on some attribute value. Each hash value is associated with a block (sequence of blocks is overflow buckets are needed) where the record is to be stored. Record Modifications We need to discuss three basic types of modification: Record Insertion Record Deletion Record Update Insertion Record insertion procedures are different for different file organizations. 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Insertion into a Heap File To insert records into a heap file, it is convenient to keep a (double-)linked list of all heap file pages with available space. The pointer to the first page of the list can be stored on the header page . The pointers to next/previous page on the list can be stored in the block headers . Assuming existance of such support, insertion of a record into a heap file can be done as follows: Algorithm InsertRecordHeap(File F, Record R) begin HeaderPage = ReadBlock(F,1); // Retrieve the header page of the file FreeSpacePageId = HeaderPage.FreeSpaceList; Block = ReadBlock(F,FreeSpacePageId); // Retrieve the block RecordNum = FindFreeSlot(Block); // find a free slot Put(R, Block, RecordNum); // write the contents of R into the // available slot
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/19/2008 for the course CSC 468 taught by Professor Dehktyar during the Spring '08 term at Cal Poly.

Page1 / 4

lec05.468 - Spring 2008 CSC 468 DBMS Implementation...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online