1 / 10

13.8 Record Modifications

13.8 Record Modifications. CS257 Lok Kei Leong ( 108 ). Outline. Record Insertion Record Deletion Record Update. Insertion. Insert new records into a relation - records of a relation in no particular order - record of a relation in fixed order (e.g. sorted by primary key)

aron
Download Presentation

13.8 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. 13.8 Record Modifications CS257 Lok Kei Leong ( 108 )

  2. Outline • Record Insertion • Record Deletion • Record Update

  3. Insertion • Insert new records into a relation- records of a relation in no particular order- record of a relation in fixed order (e.g. sorted by primary key) • A pointer to a record from outside the block is a “structured address” Offeset table header unused Record 2 Record 3 Record 4 Record 1

  4. What If The Block is Full? • If we need to insert the record in a particular block but the block is full. What should we do? • Find room outside the Block • There are 2 solutions • Find Space on Nearby Block • Create an Overflow Block

  5. Insertion (solution 1) • Find space on a “nearby” block • Block B1 has no space • If space available on block B2 move records of B1 to B2 • If there are external pointers to records of B1 moved to B2 leave forwarding address in offset table of B1

  6. Insertion (solution 2) • Create an overflow block • Each block B has its header pointer to an overflow block where additional blocks of B can be placed Block B Overflow block for B

  7. Deletion • Slide around the block • Cannot slide records- maintain an available-space list in the block headerto keep track of space available • Avoid dangle or wind up pointing to a new record

  8. Tombstone • What about pointer to deleted records ? • A tombstone is placed in place of each deleted record • A tombstone is a bit placed at first byte of deleted record to indicate the record was deleted ( 0 – Not Deleted 1 – Deleted) • A tombstone is permanent Record 1 Record 2

  9. Update • For Fixed-Length Records, there is no effect on the storage system • For variable length records: • associated with insertion and deletion(never create a tombstone for old record) • Longer updated recordcreate more space on its block- sliding records - create an overflow block

  10. Question?

More Related