1 / 10

Record Modifications

Record Modifications. Chapter 13 Section 13.8 Neha Samant CS 257 (Section II) Id 222. Modification type:Insertion. 2. Insertion of records without order Records can be placed in a block with empty space or in a new block. Insertion of records in fixed order

ferris-ross
Download Presentation

Record Modifications

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Record Modifications Chapter 13 Section 13.8 Neha Samant CS 257 (Section II) Id 222

  2. Modification type:Insertion 2 • Insertion of records without order Records can be placed in a block with empty space or in a new block. Insertion of records in fixed order • Space available in the block • No space available in the block (outside the block) Structured address Pointer to a record from outside the block.

  3. Insertion in fixed order Offset table header unused Record 4 Record 3 Record 2 Record 1 3 Space available within the block • Use of an offset table in the header of each block with pointers to the location of each record in the block. • The records are slid within the block and the pointers in the offset table are adjusted.

  4. Insertion in fixed order Block B Overflow block for B No space available within the block (outside the block) • Find space on a “nearby” block. • In case of no space available on a block, look at the following block in sorted order of blocks. • If space is available in that block ,move the highest records of first block 1 to block 2 and slide the records around on both blocks. • Create an overflow block • Records can be stored in overflow block. • Each block has place for a pointer to an overflow block in its header. • The overflow block can point to a second overflow block as shown below. 4

  5. Modification type: Deletion 5 • Recover space after deletion • When using an offset table, the records can be slid around the block so there will be an unused region in the center that can be recovered. • In case we cannot slide records, an available space list can be maintained in the block header. • The list head goes in the block header and available regions hold the links in the list.

  6. Deletion • Use of tombstone • The tombstone is placed in a record in order to avoid pointers to the deleted record to point to new records. • The tombstone is permanent until the entire database is reconstructed. • If pointers go to fixed locations from which the location of the record is found then we put the tombstone in that fixed location. (See examples) • Where a tombstone is placed depends on the nature of the record pointers. • Map table is used to translate logical record address to physical address. 6

  7. Record 1 Record 2 Deletion • Use of tombstone • If we need to replace records by tombstones, place the bit that serves as the tombstone at the beginning of the record. • This bit remains the record location and subsequent bytes can be reused for another record Record 1 can be replaced, but the tombstone remains, record 2 has no tombstone and can be seen when we follow a pointer to it. 7

  8. Modification type: Update 8 • Fixed Length update No effect on storage system as it occupies same space as before update. • Variable length update • Longer length • Short length

  9. Update 9 Variable length update (longer length) • Stored on the same block: • Sliding records • Creation of overflow block. • Stored on another block • Move records around that block • Create a new block for storing variable length fields.

  10. Update 10 Variable length update (Shorter length) • Same as deletion • Recover space • Consolidate space.

More Related