# 13.8 Record Modifications - PowerPoint PPT Presentation

1 / 10

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)

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

## 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)

• A pointer to a record from outside the block is a “structured address”

Offeset table

unused

Record 2

Record 3

Record 4

Record 1

### 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

### 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

### 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

### 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

### 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

### 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