Database System Implementation CSE 507

Slides:



Advertisements
Similar presentations
Request Dispatching for Cheap Energy Prices in Cloud Data Centers
Advertisements

SpringerLink Training Kit
Luminosity measurements at Hadron Colliders
From Word Embeddings To Document Distances
Choosing a Dental Plan Student Name
Virtual Environments and Computer Graphics
Chương 1: CÁC PHƯƠNG THỨC GIAO DỊCH TRÊN THỊ TRƯỜNG THẾ GIỚI
THỰC TIỄN KINH DOANH TRONG CỘNG ĐỒNG KINH TẾ ASEAN –
D. Phát triển thương hiệu
NHỮNG VẤN ĐỀ NỔI BẬT CỦA NỀN KINH TẾ VIỆT NAM GIAI ĐOẠN
Điều trị chống huyết khối trong tai biến mạch máu não
BÖnh Parkinson PGS.TS.BS NGUYỄN TRỌNG HƯNG BỆNH VIỆN LÃO KHOA TRUNG ƯƠNG TRƯỜNG ĐẠI HỌC Y HÀ NỘI Bác Ninh 2013.
Nasal Cannula X particulate mask
Evolving Architecture for Beyond the Standard Model
HF NOISE FILTERS PERFORMANCE
Electronics for Pedestrians – Passive Components –
Parameterization of Tabulated BRDFs Ian Mallett (me), Cem Yuksel
L-Systems and Affine Transformations
CMSC423: Bioinformatic Algorithms, Databases and Tools
Some aspect concerning the LMDZ dynamical core and its use
Bayesian Confidence Limits and Intervals
实习总结 (Internship Summary)
Current State of Japanese Economy under Negative Interest Rate and Proposed Remedies Naoyuki Yoshino Dean Asian Development Bank Institute Professor Emeritus,
Front End Electronics for SOI Monolithic Pixel Sensor
Face Recognition Monday, February 1, 2016.
Solving Rubik's Cube By: Etai Nativ.
CS284 Paper Presentation Arpad Kovacs
انتقال حرارت 2 خانم خسرویار.
Summer Student Program First results
Theoretical Results on Neutrinos
HERMESでのHard Exclusive生成過程による 核子内クォーク全角運動量についての研究
Wavelet Coherence & Cross-Wavelet Transform
yaSpMV: Yet Another SpMV Framework on GPUs
Creating Synthetic Microdata for Higher Educational Use in Japan: Reproduction of Distribution Type based on the Descriptive Statistics Kiyomi Shirakawa.
MOCLA02 Design of a Compact L-­band Transverse Deflecting Cavity with Arbitrary Polarizations for the SACLA Injector Sep. 14th, 2015 H. Maesaka, T. Asaka,
Hui Wang†*, Canturk Isci‡, Lavanya Subramanian*,
Fuel cell development program for electric vehicle
Overview of TST-2 Experiment
Optomechanics with atoms
داده کاوی سئوالات نمونه
Inter-system biases estimation in multi-GNSS relative positioning with GPS and Galileo Cecile Deprez and Rene Warnant University of Liege, Belgium  
ლექცია 4 - ფული და ინფლაცია
10. predavanje Novac i financijski sustav
Wissenschaftliche Aussprache zur Dissertation
FLUORECENCE MICROSCOPY SUPERRESOLUTION BLINK MICROSCOPY ON THE BASIS OF ENGINEERED DARK STATES* *Christian Steinhauer, Carsten Forthmann, Jan Vogelsang,
Particle acceleration during the gamma-ray flares of the Crab Nebular
Interpretations of the Derivative Gottfried Wilhelm Leibniz
Advisor: Chiuyuan Chen Student: Shao-Chun Lin
Widow Rockfish Assessment
SiW-ECAL Beam Test 2015 Kick-Off meeting
On Robust Neighbor Discovery in Mobile Wireless Networks
Chapter 6 并发:死锁和饥饿 Operating Systems: Internals and Design Principles
You NEED your book!!! Frequency Distribution
Y V =0 a V =V0 x b b V =0 z
Fairness-oriented Scheduling Support for Multicore Systems
Climate-Energy-Policy Interaction
Hui Wang†*, Canturk Isci‡, Lavanya Subramanian*,
Ch48 Statistics by Chtan FYHSKulai
The ABCD matrix for parabolic reflectors and its application to astigmatism free four-mirror cavities.
Measure Twice and Cut Once: Robust Dynamic Voltage Scaling for FPGAs
Online Learning: An Introduction
Factor Based Index of Systemic Stress (FISS)
What is Chemistry? Chemistry is: the study of matter & the changes it undergoes Composition Structure Properties Energy changes.
THE BERRY PHASE OF A BOGOLIUBOV QUASIPARTICLE IN AN ABRIKOSOV VORTEX*
Quantum-classical transition in optical twin beams and experimental applications to quantum metrology Ivano Ruo-Berchera Frascati.
The Toroidal Sporadic Source: Understanding Temporal Variations
FW 3.4: More Circle Practice
ارائه یک روش حل مبتنی بر استراتژی های تکاملی گروه بندی برای حل مسئله بسته بندی اقلام در ظروف
Decision Procedures Christoph M. Wintersteiger 9/11/2017 3:14 PM
Limits on Anomalous WWγ and WWZ Couplings from DØ
Presentation transcript:

Database System Implementation CSE 507 Buffer Managers Some slides adapted from Prof Chris Re Stanford.

Buffer Managers Buffer manager: A module in a database intelligently shuffles data from main memory to disk. It is transparent to higher levels of DBMS operation

Buffer Managers Summary Page Requests from Higher Levels READ WRITE BUFFER POOL disk page free frame INPUT OUTUPT MAIN MEMORY DISK DB choice of frame dictated by replacement policy Data must be in RAM for DBMS to operate on it! Table of <frame#, pageid> pairs is maintained

When a bucket/page is requested If the requested page/bucket in the buffer pool No need to go back to the disk! If not? Choose a frame to replace. If there is a free frame, use it! Terminology: We pin a page (means it’s in use) If not? We need to choose a page to remove! What would be good strategy? --- Replacement policy

A simple strategy A page is dirty, if its contents have been changed after writing Buffer Manager keeps a dirty bit Say we choose to evict P If P is dirty, we write it to disk What if no page is dirty? Or multiple pages are dirty?

Review of Some strategies from OS-- LRU Order pages by the time of last accessed Always replace the least recently accessed P5, P2, P8, P4, P1, P9, P6, P3, P7 Access P6 P6, P5, P2, P8, P4, P1, P9, P3, P7

Some strategies from OS– Clock algorithm Instead we maintain a “last used clock” Think of buckets ordered 1…N around a clock “The hand” sweeps around Buckets keep a “ref bit” set to 1 or 0. Whenever a bucket is fetched in its “ref bit” is set to 1. Similarly it is set to “1” whenever it is referenced. The buffer manager’s “hand” looks for the first 0 for replacement. Whenever it passes by a “1” it is set to “0”.

Some strategies from OS– MRU algorithm Most Recently Used. Are you kidding me? Why would you ever want to use this? Hint: Consider the inner loop behavior of a nested loop join. Material adapted from Prof Chris Re Stanford.

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For Last used time LRU – Assume 3 buffers; R=2 S = 3 blocks --- Page Fault Counter = 0 --- ---

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For Last used time LRU – Assume 3 buffers; R=2 S = 3 blocks Block1 from R T=1 Page Fault Counter = 1 --- Page fault for Block 1 of R !! Which one would be replaced? ---

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For Last used time LRU – Assume 3 buffers; R=2 S = 3 blocks Block1 from R T=1 Page Fault Counter = 2 Block1 from S T=1 Page fault for Block 1 of S !! Which one would be replaced? ---

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For Last used time LRU – Assume 3 buffers; R=2 S = 3 blocks Block1 from R T=1 Page Fault Counter = 2 Assuming each page has k records in it Block1 from S T=k Page request for Block 1 of join !!! Output block T=k

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For Last used time LRU – Assume 3 buffers; R=2 S = 3 blocks Block1 from R T=k^2 - k At this stage block 1 of R joined with bock 1 of S Page Fault Counter = 2 Block1 from S T=k^2 Note that the last used timestamps depend on how the use is counted. Output block T=k^2

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For Last used time LRU – Assume 3 buffers; R=2 S = 3 blocks Block1 from R T=k^2 - k At this stage block 1 of R joined with bock 1 of S Page Fault Counter = 2 Block1 from S T=k^2 So instead of exact number the key thing to follow is: last used of R < that of S Output block T=k^2

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For Last used time LRU – Assume 3 buffers; R=2 S = 3 blocks Block1 from R T=k^2 -k Page Fault Counter = 3 Page Fault Counter = 0 Block1 from S T=k^2 Page fault for Block 2 of S !! Which one would be replaced? Output block T=k^2

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For Last used time Which one would MRU have replaced?? Would it have prevented any unnecessary page fault Block2 from S T=k^2 +1 Page Fault Counter = 3 Block1 from S T=k^2 Output block T=k^2

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For Last used time LRU – Assume 3 buffers; R=2 S = 3 blocks Block2 from S T=k^2 +1 Page Fault Counter = 3 Page fault for Block 1 of R !! Which one would be replaced? Block1 from S T=k^2 Output block T=k^2

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For Last used time LRU – Assume 3 buffers; R=2 S = 3 blocks Block2 from S T=k^2 +1 Page Fault Counter = 4 Block1 from R T=k^2 +2 Output block T=k^2

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For LRU – Assume 3 buffers; R=2 S = 3 blocks Last used time Block2 from S T=k^2+1 +k Page Fault Counter = 4 Block1 from R T=k^2+2 Output block T=k^2 + 1+k

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For LRU – Assume 3 buffers; R=2 S = 3 blocks Last used time Block2 from S T=k^2+1+k^2 Page Fault Counter = 4 block 1 of R joined with block 2 of S Block1 from R T=k^2+2 + k^2 -k Output block T=2k^2 + 1

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For Last used time LRU – Assume 3 buffers; R=2 S = 3 blocks Block2 from S T=2k^2+1 Page Fault Counter = 5 Block1 from R Page fault for Block 3 of S !! Which one would be replaced? T=2k^2 + 2 - k Output block T=2k^2 + 1

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For Last used time Which one would MRU have replaced?? Would it have prevented any unnecessary page fault Block2 from S T=2k^2+1 Page Fault Counter = 5 Block3 from S T= 2k^2 + 2 Output block T=2k^2 + 1

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For Last used time LRU – Assume 3 buffers; R=2 S = 3 blocks Block2 from S T=2k^2+1 Page Fault Counter = 6 Block3 from S Page fault for Block 1 of R !! Which one would be replaced? T= 2k^2 + 2 Output block T=2k^2 + 1

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For Last used time LRU – Assume 3 buffers; R=2 S = 3 blocks Block1 from R T=2k^2+3 Page Fault Counter = 6 Block3 from S Page fault for Block 1 of R !! Which one would be replaced? T= 2k^2 + 2 Output block T=2k^2 + 1

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For Last used time LRU – Assume 3 buffers; R=2 S = 3 blocks Block1 from R T=2k^2+3 Page Fault Counter = 6 Block3 from S T= 2k^2 + 2 + k Output block T=2k^2 + 2 + k

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For Last used time LRU – Assume 3 buffers; R=2 S = 3 blocks Block1 from R T=2k^2+3 +k^2 -k Page Fault Counter = 6 By now block 1 of R joined with block 3 of S Block3 from S T= 2k^2 + 2 + k^2 Output block T=2k^2 + 2 + k^2

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For Last used time LRU – Assume 3 buffers; R=2 S = 3 blocks Block1 from R T=3k^2+3 - k Page Fault Counter = 7 Page fault for Block 2 of R !! Which one would be replaced? Block3 from S T= 3k^2 + 2 Output block T=3k^2 + 2

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For Last used time LRU – Assume 3 buffers; R=2 S = 3 blocks Block2 from R T=3k^2+ 3 Page Fault Counter = 8 Page fault for Block 1 of S !! Which one would be replaced? Block3 from S T= 3k^2 + 2 Output block T=3k^2 + 2

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For Last used time LRU – Assume 3 buffers; R=2 S = 3 blocks Block2 from R T=3k^2+ 3 Page Fault Counter = 8 Block1 from S T= 3k^2 + 4 Output block T=3k^2 + 2

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For Last used time LRU – Assume 3 buffers; R=2 S = 3 blocks Block2 from R T=3k^2+ 3 Page Fault Counter = 8 Block1 from S T= 3k^2 + 4 +k Output block T=3k^2 + 4 +k

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For Last used time LRU – Assume 3 buffers; R=2 S = 3 blocks Block2 from R T=3k^2+ 3 + k^2 - k Page Fault Counter = 8 Block 2 of R joined with block 1 of S Block1 from S T= 3k^2 + 4 +k^2 Output block T=3k^2 + 4 +k^2

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For Last used time LRU – Assume 3 buffers; R=2 S = 3 blocks Block2 from R T=4k^2+ 3 - k Page Fault Counter = 9 Page fault for Block 2 of S !! Which one would be replaced? Block1 from S T= 4k^2 + 4 Output block T=4k^2 + 4

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For Which one would MRU have replaced?? Would it have prevented any unnecessary page fault Last used time Block2 from S T=4k^2+ 5 Page Fault Counter = 9 Block1 from S T= 4k^2 + 4 Output block T=4k^2 + 4

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For Last used time LRU – Assume 3 buffers; R=2 S = 3 blocks Block2 from S T=4k^2+ 5 Page Fault Counter = 10 Page fault for Block 2 of R !! Which one would be replaced? Block1 from S T= 4k^2 + 4 Output block T=4k^2 + 4

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For Last used time LRU – Assume 3 buffers; R=2 S = 3 blocks Block2 from S T=4k^2+ 5 Page Fault Counter = 10 Block2 from R T= 4k^2 + 6 Output block T=4k^2 + 4

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For Last used time LRU – Assume 3 buffers; R=2 S = 3 blocks Block2 from S T=4k^2+ 5 +k Page Fault Counter = 10 Block2 from R T= 4k^2 + 6 Output block T=4k^2 + 5 + k

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For Last used time LRU – Assume 3 buffers; R=2 S = 3 blocks Block2 from S T=4k^2+ 5 +k^2 Page Fault Counter = 10 Block 2 of R joined with block 2 of S Block2 from R T= 4k^2 + 6 + k^2 -k Output block T=4k^2 + 5 + k^2

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For Last used time LRU – Assume 3 buffers; R=2 S = 3 blocks Block2 from S Page fault for Block 3 of S !! Which one would be replaced? T=5k^2+ 5 Page Fault Counter = 11 Block2 from R T= 5k^2 + 6 - k Output block T=5k^2 + 5

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For Last used time Which one would MRU have replaced?? Would it have prevented any unnecessary page fault Block2 from S T=5k^2+ 5 Page Fault Counter = 11 Block3 from S T= 5k^2 + 6 Output block T=5k^2 + 5

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For Last used time LRU – Assume 3 buffers; R=2 S = 3 blocks Block2 from S T=5k^2+ 5 Page Fault Counter = 12 Page fault for Block 2 of R !! Which one would be replaced? Block3 from S T= 5k^2 + 6 Output block T=5k^2 + 5

LRU vs MRU --- Case on Nested Loop Join How would LRU and MRU perform on this Nested join algorithm? For each block in Relation R For each block in Relation S Test the join condition specified on each pair of records End For Compare with: Cost from estimated models of nested loop. Any surprises? MRU algorithm, For MRU--Care needs to be taken to prevent infinite page faults. May need to avoid replacing the page just brought it. Page Fault Counter = 12

Database Buffer managers can be much smarter these!

Domain Separation Technique Separate pages into statically assigned domains If page of type X is needed, then allocate in pool X LRU in each Domain If none are available in current domain (all pages have IO going on them), then borrow from another domain. 1: Root 2: Internal Nodes 3: Leaves

Pros and Cons of Domain Separation Pro: Big observation. Not all pages are the same! Con 1: Concept of domain is static Replacement should depend on how page is used Importance of a page depends on which algo is using it. E.g., a page of a relation in a sequential scan v. a nested join Con 2: No priorities among domains Index pages more frequently used than data pages. But this would allow index page to be over-written by another index page.

Separate Buffer pool for each relation == Working set “New” Algorithm Two Key Observations “The priority of a page is not a property of the page; in contrast, it is a property of the relation to which that page belongs.” Each relation has its own Working Set Separate Buffer pool for each relation == Working set

“New” Algorithm: Resident Set of Pages Free Pages List The resident sets are linked in a priority list. There is also a global free list at the top. Increasing importance of pages MRU, Relation 1 MRU, Relation 2 Each relation is assigned: Resident Set of Pages. Internally MRU is used for each relation.

“New” Algorithm: Resident Set of Pages Free Pages List Increasing importance of pages MRU, Relation 1 MRU, Relation 2 Intuition: - If near the top, then unlikely to be reused. - If near the bottom then pages are protected.

“New” Algorithm When a page fault occurs: Search is initiated from the top of the priority list. 2. Each relation is entitled to few buffers which are exempt from replacement consideration. Ordering among relations can be adjusted. A relation is place near top if its pages are unlikely to be re-used. Else it is protected at bottom.

Pros and Cons of “New” algorithm “New” algorithm could track locality of queries through relations. Advantages of MRU are limited to some cases. Ordering the relations is not trivial. Heuristic based (one could imagine some stats) Extensions to multi-user environment was not clear.

Hot Set Algorithm A hotset is a set of pages that an operation will loop over many times. Key Idea: If a query is given a buffer large enough to hold the hot sets. Then its processing would be efficient On the other hand, If a query is given less than it hot sets. It will have many page faults.

Nested Loop Join Hotset Hot Set Algorithm A hotset is a set of pages that an operation will loop over many times. Nested Loop Join Hotset = 1 + #blocks of S . Why? LRU # Page Faults Hot point # Buffers

Nested Loop Join Hotset Hot Set Algorithm A hotset is a set of pages that an operation will loop over many times. Nested Loop Join Hotset = 1 + #blocks of S . Why? LRU # Page Faults MRU Hot point Model was tied to LRU MRU may be better! # Buffers

DBMIN– Buffer management System

Query Locality Set Model (QLSM) Database access methods are predictable handful of typical algorithms So, define a handful of reference access methods.

Query Locality Set Model --- Nested Loop For instance, consider an index nested loop join with an index on the joining attribute. Two locality sets of this query: Index and data pages of the inner relation Sequential scan of the outer relation.

Reference Model --- Sequential Sequential References: Scanning a relation. Straight Sequential (SS). Only one access without repetition. How many pages should we allocate? Clustered Sequential (CS). Think Merge Join on a equality join What should we keep together? Looping Sequential (CR). Think Nested loop Join. What replacement policy on inner?

Reference Model --- Sequential Sequential References: Scanning a relation. Straight Sequential (SS). Only one access without repetition. How many pages should we allocate? (one) Clustered Sequential (CS). Think Merge Join What should we keep together? (records of a “cluster”, i.e., they have the same value) Looping Sequential (CR). Nested loop Join. What replacement policy on inner? (MRU)

Reference Model --- Hierarchical Straight Hierarchical: B+Tree Probe (X = 10) Hierarchical + Straight Sequential (X >= 10) (traversing the tree followed by a scan through leaves) Looping Hierarchical: Index-Nested Loop Join Inner relation has the index. Examples of Random References? Data pages are retrieved in random order.

DBMIN– Buffer management using QLSM Buffers are managed on a per file instance Active instances of the same file are given different buffer pools – In fact they may use different replacement policies! Files share pages via global table. Set of buffered pages associated with a file instance is called its locality set.

DBMIN– Buffer management using QLSM Replacement Policy (RP) of a buffer simply moves to Global Free list (not actual eviction!). Notation used: N : The total number of buffer frames available in system. Lij : The maximum number of buffers that can be allocated to a file instance j of query i. Rij : the #buffers allocated to file instance j of query i.

DBMIN– In case of Page Fault Case I: page in both global table and locality set of requesting process: Simply update stats (of as used by RP policy) and return.

DBMIN– In case of Page Fault Case II: Page in memory, but not in locality set If page has an owner, then simply return it Otherwise, page is allocated to requestor’s Locality Set. R is incremented by one. If R > L then a page is released to the global free list. Case III: Page not in memory. Bring it in, proceed as in case II.

DBMIN – #buffers and RP in QLSM Straight Sequential References: Locality set size: 1 ; new page overwrites the current. Clustered Sequential References: Locality set size: #recs in largest cluster/bfr ; LRU or FIFO Looping Sequential References: Locality set size: size of smaller relation; MRU

DBMIN – #buffers and RP in QLSM Random References: Use Yao’s formula to estimate the number of pages b in case of k random accesses. Locality set size between 1 and b. Residual value of a page = (k-b)/b; if < threshold then LS=1 Straight Hierarchical References: Locality set size: 1 ; new page overwrites the current.

DBMIN – #buffers and RP in QLSM Looping Hierarchical References: Index is repeatedly scanned Consider a tree with height h and fanout f. Level i would have f^i pages. If bi is #pages accessed according to Yao’s formula. Size of locality set= (1 + 𝑖=1 𝑗 𝑏 𝑖 ) + 1 Here, j is largest i such that (k-bi)/bi > a threshold Can use LIFO for this or something like domain separation for this.

DBMIN – #buffers and RP in QLSM For k references on a file with n records with m blocks #disk access (Yao’s formula) (approximately) = 𝑚 ∗ 1 − 𝑖=1 𝑡𝑜 𝑘 𝑛𝑑 −𝑖+1 𝑛−𝑖+1 ; 𝐻𝑒𝑟𝑒, 𝑑=1− 1 𝑚 ;