Database Technology

Learn / Database Technology

DBT: 3 - Caching

Practice questions on caching architecture, buffer managers, replacement policies, CLOCK, and modern challenges.

Learning path

0%

0 of 10 sections marked complete · about 56 minutes

Learning objectives

What you will be able to explain

  • According to the slides, what physical property enables the implementation of caching in computer systems?
  • The improvement in access speed provided by a cache depends on which factors?
  • OS vs. DBMS Caching: True or False
  • How does a DBMS typically handle physical memory allocation for its buffer manager?
  • Nested Loop Join and cache inefficiency
  • How does a cache contribute to faster writes in a database system?

Section 01

According to the slides, what physical property enables the implementation of caching in computer systems? to OS vs. DBMS Caching: True or False

01

According to the slides, what physical property enables the implementation of caching in computer systems?

Correct answer: The memory hierarchy.

02

The improvement in access speed provided by a cache depends on which factors?

Correct answers: A, B, C, E.

Guided checkpoint

Select all that apply.

03

OS vs. DBMS Caching: True or False

Answers: True, False, True, True.

Guided checkpoint

State whether each statement is True or False.

Section 02

How does a DBMS typically handle physical memory allocation for its buffer manager? to How does a cache contribute to faster writes in a database system?

01

How does a DBMS typically handle physical memory allocation for its buffer manager?

Correct answer: It allocates memory in virtual memory via the OS (e.g., using malloc).

02

Nested Loop Join and cache inefficiency

Path of Calculation: 1. For every block in A, DBMS scans all blocks of B. 2. A has 6 blocks and B has 4 blocks. 3. With one slot occupied by current A block, B cannot stay fully resident across scans. 4. In standard NLJ here, B is reloaded for each outer block. 5. Calculation: 6 * 4 = 24. Correct answer: 24.

Guided checkpoint

A DBMS performs a Nested Loop Join of Table A (6 blocks) and Table B (4 blocks) using the order A×BA \times B (A is the outer relation). The buffer manager has only **4 slots** and uses a **FIFO** eviction policy. How many total block loads from disk occur for the inner relation B during this join?

The buffer manager has only 4 slots and uses FIFO. How many total block loads from disk occur for inner relation B?

03

How does a cache contribute to faster writes in a database system?

Correct answer: changes can be applied in-memory first and written back later.

Section 03

Which items are typically cached by a Database Buffer Manager? to When is using chunks as buffer granularity particularly beneficial?

01

Which items are typically cached by a Database Buffer Manager?

Correct answers: A, B, C.

Guided checkpoint

Select all that apply.

02

Buffer granularity matching

Correct mapping: 1-C, 2-A, 3-B.

Guided checkpoint

Match each granularity to its description.

03

When is using chunks as buffer granularity particularly beneficial?

Correct answer: large operations like joins/sorts.

Section 04

What is the effect of pinning a block in the buffer? to Which statement best describes FIFO eviction policy?

01

What is the effect of pinning a block in the buffer?

Correct answer: pinning protects the page from eviction.

02

What factors do eviction algorithms typically consider?

Correct answers: A, B, D.

Guided checkpoint

Select all that apply.

03

Which statement best describes FIFO eviction policy?

Correct answer: eviction by insertion order.

Section 05

What is the primary intuitive advantage of LRU over FIFO? to Cache pollution from large sequential scans most commonly hurts which policy?

01

What is the primary intuitive advantage of LRU over FIFO?

Correct answer: recency is often predictive of near-future reuse.

02

In which scenario is MRU superior to LRU?

Correct answer: MRU can work better for large sequential scans.

03

Cache pollution from large sequential scans most commonly hurts which policy?

Correct answer: LRU.

Section 06

LRU vs. LFU by access pattern to In CLOCK, when pointer reaches a page with reference bit = 1 during eviction search, what happens?

01

LRU vs. LFU by access pattern

Correct mapping: 1-LFU, 2-LRU.

Guided checkpoint

Choose the best policy for each case.

02

The CLOCK algorithm is primarily an efficient approximation of which policy?

Correct answer: LRU.

03

In CLOCK, when pointer reaches a page with reference bit = 1 during eviction search, what happens?

Correct answer: set bit to 0, continue scanning.

Section 07

CLOCK eviction sequence to Why does prefetching often cost little while saving significant time?

01

CLOCK eviction sequence

Path of Calculation: 1. Pointer at Slot 1 (A): bit=1 -> set to 0, move on. 2. Slot 2 (B): bit=1 -> set to 0, move on. 3. Slot 3 (C): bit=0 -> evict C, insert D with bit=1. Correct answer: C is evicted; final bits are Slot1=0, Slot2=0, Slot3=1.

Guided checkpoint

A cache has 3 slots in a ring. Slot1: A(bit=1) and pointer starts here; Slot2: B(bit=1); Slot3: C(bit=0). New page D is inserted.

Fill in the resulting eviction and final slot state.

02

PostgreSQL Buffer Manager: True or False

Answers: True, True, True, False.

Guided checkpoint

State whether each statement is True or False.

03

Why does prefetching often cost little while saving significant time?

Correct answer: sequential + asynchronous non-blocking reads.

Section 08

Which are examples of prefetching mentioned in the slides? to Semantic Caching Challenges: True or False

01

Which are examples of prefetching mentioned in the slides?

Correct answers: A, B, C.

Guided checkpoint

Select all that apply.

02

What defines semantic caching?

Correct answer: caching query results.

03

Semantic Caching Challenges: True or False

Answers: False, True, True, True.

Guided checkpoint

State whether each statement is True or False.

Section 09

What is the key objective of the LeanStore buffer manager? to Match PostgreSQL buffer components

01

What is the key objective of the LeanStore buffer manager?

Correct answer: make SSD-based DBMS performance approach in-memory performance.

02

Why is pointer tagging used in modern buffer managers like LeanStore?

Correct answer: reduce lookup overhead.

03

Match PostgreSQL buffer components

Correct mapping: 1-A, 2-C, 3-B.

Guided checkpoint

Match each component to its description.

Section 10

In Second Chance, a page with bit=1... to Which policy is specifically noted as poor for large sequential scans due to cache pollution?

01

In Second Chance, a page with bit=1...

Correct answer: it gets a second chance on first encounter.

02

Which modern buffer manager challenges are still active research topics?

Correct answers: A, B, C.

Guided checkpoint

Select all that apply.

03

Which policy is specifically noted as poor for large sequential scans due to cache pollution?

Correct answer: LRU.

Knowledge check

Turn understanding into recall.

The quiz now follows the same concepts in scored form. You can return to this lesson from the quiz whenever a gap appears.