Database Design and Implementation 04.buffer
Database Design and Implementation 04.buffer
BUFFER POOL
disk page
free frame
MAIN MEMORY
1
When a Page is Requested...
2
Stochastic vs. Non-Stochastic
3
DBMIN Algorithm
QLSM: Examples
4
DBMIN Replacement
5
Oracle: LRU List and Write List
LRU-K Algorithm
6
LRU-K: Time-out Correlation
7
LRU-K: Buffer Replacement
2Q Algorithm [VLDB’1994]
8
2Q Buffer Replacement
On accessing a page P
If (P is in Am) then move P to the head of Am
else if (P is in A1out) then reclaim(P); add P to head(Am)
else if (P is in A1in) then do nothing (for a correlated reference)
else reclaim(P); add P to the head of A1in (P is a new page accessed)
Reclaim(P)
if (there is ANY free slot) then put P into the slot
else if (A1in is full)
remove the tail of A1in; add its id to the head of A1out
if (A1out is full) remove the tail of A1out
put P into the page slot freed from A1in
else remove the tail of Am; put P into the page slot freed from Am
2+1 Queues
– Am is the main LRU queue.
– A1in is a FIFO queue that stores newly referenced pages.
– A1out is a FIFO queue that stores page ids recently evicted
from A1in.
Partitioning of Buffer Pool
– A given buffer pool is divided into 2 queues of pages and 1
queue of page ids.
– The ratio between Am and A1in is a major tuning parameter.
9
Experimental Evaluation
10