Presentation is loading. Please wait.

Presentation is loading. Please wait.

1. 1. Database address space 2. Virtual address space 3. Map table 4. Translation table 5. Swizzling and UnSwizzling 6. Pinned Blocks 2.

Similar presentations


Presentation on theme: "1. 1. Database address space 2. Virtual address space 3. Map table 4. Translation table 5. Swizzling and UnSwizzling 6. Pinned Blocks 2."— Presentation transcript:

1 1

2 1. Database address space 2. Virtual address space 3. Map table 4. Translation table 5. Swizzling and UnSwizzling 6. Pinned Blocks 2

3  A database system is usually client-server architecture  The client applications use a conventional virtual address space  Server’s data is structured as database address space 3

4  Physical Address: each block and record has a physical address as:  Logical Address: each block can have a shorter address (4 bytes) as logical address.  A map table can translate logical-to-physical 4 Host Disk ID Cylind. Num. Track #Block #Offset

5 5 LogicalPhysical Logical address Physical address

6  Why we use map table?  Answer: flexibility in data manipulation  How?  All pointers to the records refer to the map table  When moving records around or deleting, we can update the map table. 6

7  How to combine physical and logical addresses?  With the physical address, reach the block and using the key value to find the record  Keep an offset table in the block header 7 Host Disk ID Cylind. Num. Track #Block # Key Value Offset Table Unused Record 4 Record 3 Record 2 Record 1

8  To move a record in a block, just change the offset table entry  To delete a record, just leave a tombstone in the offset table  To move to another block, just put the new block address in the offset table (forwarding address) 8

9  There are some cases that records contain pointers  When records represent objects (and not tuples)  Object-Relational databases  Index blocks (next chapter) 9

10  Here are some facts:  We know that all data manipulations are done in main memory.  To refer a data item on HD, we use database address space.  To refer a data item in memory, we use memory address. 10

11 Question: what would happen to the pointers when we move the block from the secondary storage to memory? 11

12  So, we need a translation table to map this correspondence. 12 Database Address Memory Address Database Address Memory address

13  The techniques that change the pointer addresses is known as Pointer Swizzling.  The idea is that we should change the pointers content in order to point to the right locations. 13

14  When we move a block to memory, we put an entry for each pointer it has into the translation table. 14

15  In this technique, we swizzle the pointers when we need them.  In this way we save the time because some records won’t be invoked at all. 15

16  In this technique, we just create the translation table for the blocks and don’t swizzle the pointers inside the blocks.  It means that the pointers always use database address space. 16

17  Question: what would happen to the pointers when we move the block from memory to the secondary storage?  The pointers should be changed to database address space. This is called Unswizzling!  The translation table can be used in both direction. 17

18  If the block in the memory cannot be written back to the disk safely, we call it Pinned.  Example: Block B1 has a swizzled pointer to a record in Block B2. What would happen if we move the B2?  In this situation, we set the pin bit of B2 to prevent moving of B2. 18

19  One possible approach is to keep track of all references to a block in a linked list. 19

20 20


Download ppt "1. 1. Database address space 2. Virtual address space 3. Map table 4. Translation table 5. Swizzling and UnSwizzling 6. Pinned Blocks 2."

Similar presentations


Ads by Google