Presentation is loading. Please wait.

Presentation is loading. Please wait.

12.5 Record Modifications Sadiya Hameed ID: 206 CS257.

Similar presentations


Presentation on theme: "12.5 Record Modifications Sadiya Hameed ID: 206 CS257."— Presentation transcript:

1 12.5 Record Modifications Sadiya Hameed ID: 206 CS257

2 Insertion Unordered records Put it in any block with empty space, or a new block Ordered records (e.g. sorted by primary key) If space available in block, slide around records to make room at proper point Otherwise, find space in nearby blocks or create overflow block

3 Ordered Record Insertion (contd.) Fig. 12.16: An offset table lets us slide records within a block to make room for new records record 1record 2record 3record 4 unused offset table header If space in current block, slide records around within the block and adjust pointers in the offset table.

4 Ordered Record Insertion (contd.) If no space available in current block Find space on a nearby block: In case of external pointers, leave forwarding addresses in old offset table Create an overflow block: Block B Overflow block for block B Fig. 12.17 A block and its first overflow block

5 Deletion If using offset table, reclaim space by sliding records around the block (single unused region at center) Else, keep an available-space list in the block header (block header only needs the list head, available regions hold the links in the list) If possible, remove an overflow block

6 Deletion: Complication! If pointers exist to the deleted record – dangling pointers! Solution: Tombstones Fixed locations exist for finding the record If using offset-table, place null pointer in the offset table If using map table, place null pointer instead of physical address Else, use first bit of record header as a tombstone bit record 1 record 2 Fig. 12.18 Record one can be replaced (tombstone remains), record two exists

7 Update No effect of updating fixed length record Updating variable length record means taking care of the same problems as insertion and deletion

8 Unresolved Questions Are overflow blocks dedicated to one block? Or can multiple blocks use their space? Do we slide records around to insert variable length records?


Download ppt "12.5 Record Modifications Sadiya Hameed ID: 206 CS257."

Similar presentations


Ads by Google