Representing Block & Record Addresses

Download Report

Transcript Representing Block & Record Addresses

Representing Block & Record
Addresses
Presented By
Meenakshi Mali
ID: 206
Outline


Types of Addresses
Pointer Swizzling






Automatic swizzling
Swizzling on demand
No swizzling
Programmer control of swizzling
Returning Blocks to Disk
Pinned Records and Blocks
Types of Addresses

What is address?



Commonly, database system consists of
Client – Server architecture
Client application uses virtual address space
Server uses database address space, referred to
as blocks
continued..
Types of Addresses

Physical Address


Byte strings referring to the place within
secondary storage where data(record) is
saved
Logical Address

Arbitrary string of bytes of some fixed
length that maps to physical address
continued..
Map Table
More on Logical Address

Purpose


Easy updating of records
Structured address
Pointer Swizzling



As discussed earlier, every record in memory
has two forms of addresses
We can use either to access record
When block is moved from secondary storage
to main memory pointers within block are
“swizzled”,i.e translated from database
address space (Server) to virtual address
space (Client)


Consists of a bit indicating if pointer is currently a
database address or memory address
The database or memory pointer itself
Pointer Swizzling
Types of Swizzling

Automatic Swizzling


Swizzling on Demand



Whenever a block is moved to main memory
swizzle all its pointers
Leave all pointers unswizzled when block is first
loaded into memory, swizzle the pointer only if we
need to follow it
Programmer Control of Swizzling
No Swizzling

Never swizzle the pointers. Advantage is there is
no need to load record in main memory
Returning Blocks to Disk

When a block is moved from memory
back to disk, any pointers within that
block must be unswizzled, i.e. memory
address must be replaced by database
address.
Pinned Records and Blocks



‘Pinned’ means if the block cannot be
written back to disk safely
Indicated by a bit located in the header
of the block
To write a pinned block back to disk we
need to ‘unpin’ the block

Unswizzle any pointers associated to it

Thank You

Any Questions?