100 likes | 195 Views
Database systems the complete book 13.8. record modification By Ahmad Yazdankhah ( ID 219) CS 257 P rof.: T. Y. Lin San José State University SPRING 2011. Overview. What problems we would have during: Insertion Deletion Update. 13.8.1 . Insertion. What would we do for record insertion?
E N D
Database systemsthe complete book13.8. record modificationByAhmad Yazdankhah(ID 219)CS 257Prof.: T. Y. LinSan José State UniversitySPRING 2011
Overview What problems we would have during: • Insertion • Deletion • Update
13.8.1. Insertion • What would we do for record insertion? • Find a block with enough empty space • Get a new block • But what would happen if we should insert the record in a specific block?
13.8.1. Insertion (cont’d) • There are two possibilities: • There is enough room in the target block • There is not enough room in the target block • In the 1st case, insert and update the offset table • In the 2nd case, there are two approaches: • Find space on a nearby block and slide the records • Create an overflow block
13.8.1. Insertion (cont’d) • What is an overflow block? • It is another block in which we put the records that theoretically belong to this block. • In block’s header, there is a pointer to an overflow.
13.8.2. Deletion • The usual technique is to put a tombstone in place of the record. • This is not the case that we delete the record physically. • This is a permanent tombstone until the database is reconstructed.
13.8.2. Deletion (cont’d) • Where to put the sign of deletion? • If using offset table in the block header, put null in the pointer’s place • If using a map table, put null in physical address
13.8.3. Update • No problem if fixed length records • The problems arise for variable length records • We have all problems mentioned for insertion and deletion
13.8.3. Update (cont’d) • If the new record is shorter: • Slide down the records to consolidate the free spaces • If the new record is longer: • Slide down the records to make room • Create an overflow block