1 / 16

RECORD MODIFICATION

AKSHAY SHENOY CLASS ID :108 Topic 13.8 Proffesor : T.Y Lin. RECORD MODIFICATION. INTRODUCTION. What is Record ? Record is a single, implicitly structured data item in the database table. Record is also called as Tuple. What is definition of Record Modification ?

kael
Download Presentation

RECORD MODIFICATION

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. AKSHAY SHENOY CLASS ID :108 Topic 13.8 Proffesor : T.Y Lin RECORD MODIFICATION

  2. INTRODUCTION • What is Record ? • Record is a single, implicitly structured data item in the database table. Record is also called as Tuple. • What is definition of Record Modification ? • We say Records Modified when a data manipulation operation is performed.

  3. STRUCTURE OF A RECORD • RECORD STRUCTURE FOR A PERSON TABLE • CREATE TABLE PERSON ( NAME CHAR(30), ADDRESS CHAR(256) , GENDER CHAR(1), BIRTHDATE CHAR(10));

  4. TYPES OF RECORDS • FIXED LENGTH RECORDS • CREATE TABLE SJSUSTUDENT(STUDENT_ID • INT(9) NOT NULL , PHONE_NO INT(10) NOT NULL); • VARIABLE LENGTH RECORDS • CREATE TABLE SJSUSTUDENT(STUDENT_ID INT(9) NOT NULL, • NAME CHAR(100) ,ADDRESS CHAR(100) ,PHONE_NO INT(10) NOT NULL);

  5. RECORD MODIFICATION • Modification of Record • Insert • Update • Delete • Issues even with Fixed Length Records • More Issues with Variable Length Records

  6. STRUCTURE OF A BLOCK & RECORDS • Various Records are clubbed together and stored together in memory in blocks • STRUCTURE OF BLOCK

  7. BLOCKS & RECORDS • If records need not be any particular order, then just find a block with enough empty space • We keep track of all records/tuples in a relation/tables using Index structures, File organization concepts

  8. Inserting New Records • If Records are not required to be a particular order, just find an empty block and place the record in the block. • eg: Heap Files • What if the Records are to be Kept in a particular Order(eg: sorted by primary key) ? • Locate appropriate block,check if space is available in the block if yes place the record in the block.

  9. INSERTING NEW RECORDS • We may have to slide the Records in the Block to place the Record at an appropriate place in the Block and suitably edit the block header.

  10. What If The Block Is Full ? • We need to Keep the record in a particular block but the block is full. How do we deal with it ? • We find room outside the Block • There are 2 approaches to finding the room for the record. • Find Space on Nearby Block • Create an Overflow Block

  11. APPROACHES TO FINDING ROOM FOR RECORD • FIND SPACE ON 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

  12. APPROACHES TO FINDING ROOM FOR RECORD • CREATE OVERFLOW BLOCK • EACH BLOCK B HAS IN ITS HEADER POINTER TO AN OVERFLOW BLOCK WHERE ADDITIONAL BLOCKS OF B CAN BE PLACED.

  13. DELETION • Try to reclaim the space available on a record after deletion of a particular record • If an offset table is used for storing information about records for the block then rearrange/slide the remaining records. • If Sliding of records is not possible then maintain a SPACE-AVAILABLE LIST to keep track of space available on the Record.

  14. 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

  15. UPDATING RECORDS • For Fixed-Length Records, there is no effect on the storage system • For variable length records : • If length increases, like insertion “slide the records” • If length decreases, like deletion we update the space-available list, recover the space/eliminate the overflow blocks.

  16. THANK YOU

More Related