Learning objectives
What you will be able to explain
- Which level of the memory hierarchy can be accessed the fastest?
- Temporal locality means ...
- Which level of the memory hierarchy can typically store the most data?
- RAID 5 improves the protection against data loss caused by crashes.
- Row stores yield better performance for transactional workloads than column stores.
- Disk access of analytical queries is reduced when using column stores.
Section 01
Which level of the memory hierarchy can be accessed the fastest? to Which level of the memory hierarchy can typically store the most data?
01
Which level of the memory hierarchy can be accessed the fastest?
Guided checkpoint
Choose one answer.
02
Temporal locality means ...
Guided checkpoint
Mark each statement as True or False.
03
Which level of the memory hierarchy can typically store the most data?
Guided checkpoint
Choose one answer.
Section 02
RAID 5 improves the protection against data loss caused by crashes. to Disk access of analytical queries is reduced when using column stores.
01
RAID 5 improves the protection against data loss caused by crashes.
02
Row stores yield better performance for transactional workloads than column stores.
03
Disk access of analytical queries is reduced when using column stores.
Section 03
Column stores, in general, yield better performance when doing point queries (e.g., reading a single tuple) compared to row stores. to Vertical partitioning aims at reducing the I/O cost for every single incoming query.
01
Column stores, in general, yield better performance when doing point queries (e.g., reading a single tuple) compared to row stores.
02
Which of the following statements is true for 'vertical partitioning'?
Guided checkpoint
Choose one answer.
03
Vertical partitioning aims at reducing the I/O cost for every single incoming query.
Section 04
Pointer swizzling and unswizzling are used to... to How many blocks are retrieved for employee_id = 1?
01
Pointer swizzling and unswizzling are used to...
Guided checkpoint
Choose one answer.
02
How many blocks are retrieved for AVG(amount)?
Guided checkpoint
Consider the following relation R:
| employee_id | payment_id | amount | date |
|---|---|---|---|
| 1 | 2 | 50 | 12/05/2020 |
| 2 | 4 | 30 | 21/04/2021 |
| 3 | 3 | 20 | 15/07/2020 |
| 4 | 6 | 100 | 30/06/2020 |
| 5 | 4 | 75 | 11/02/2020 |
| 6 | 5 | 90 | 21/03/2020 |
| 7 | 7 | 310 | 10/01/2021 |
| 8 | 7 | 145 | 25/10/2020 |
Assume:
- Each field in a record consumes 4 bytes (integers as well as the date).
- Block size as well as page size is 32 bytes.
- No extra storage overhead is required for any storage model (i.e., page and block are same sized and contain purely data).
- For each query in the question below, the disk head is above the first block to be read.
- No further information about the schema exists (especially no info on indices and constraints).
How many blocks are retrieved from disk for the following query?
SELECT AVG(amount)
FROM R;03
How many blocks are retrieved for employee_id = 1?
Guided checkpoint
Consider the following relation R:
| employee_id | payment_id | amount | date |
|---|---|---|---|
| 1 | 2 | 50 | 12/05/2020 |
| 2 | 4 | 30 | 21/04/2021 |
| 3 | 3 | 20 | 15/07/2020 |
| 4 | 6 | 100 | 30/06/2020 |
| 5 | 4 | 75 | 11/02/2020 |
| 6 | 5 | 90 | 21/03/2020 |
| 7 | 7 | 310 | 10/01/2021 |
| 8 | 7 | 145 | 25/10/2020 |
Assume:
- Each field in a record consumes 4 bytes (integers as well as the date).
- Block size as well as page size is 32 bytes.
- No extra storage overhead is required for any storage model (i.e., page and block are same sized and contain purely data).
- For each query in the question below, the disk head is above the first block to be read.
- No further information about the schema exists (especially no info on indices and constraints).
How many blocks are retrieved from disk for the following query?
SELECT *
FROM R
WHERE employee_id = 1;Section 05
How large is one record if memory is 4-byte aligned? to CLOCK (Second Chance): final cache content
01
How large is one record if memory is 4-byte aligned?
Guided checkpoint
Consider the record structure with header fields pointer2schema, length, timestamp and data fields name, age, state.
| Field | Size (bytes) |
|---|---|
| pointer2schema | 1 |
| length | 1 |
| timestamp | 1 |
| name | 28 |
| age | 2 |
| state | 6 |
Note: all fields are aligned separately.
02
How many pages are required if the page size is 256 bytes?
Guided checkpoint
Assume a variable-length record with header components A, B, C, D and data fields Name, Address.
- A = 8 bytes
- B = 4 bytes
- C = 2 bytes (pointer to Name)
- D = 2 bytes (pointer to Address)
Data table (numbers in parentheses are bytes for value storage):
| Name | Address |
|---|---|
| John Doe (8) | 3734 Capitol Avenue (19) |
| Bruce Wayne (11) | 461 Still Street (16) |
| George Cross (12) | 1001 Clover Drive (17) |
| Johnny Riely (12) | 4919 Modoc Alley (16) |
| Alfred Thaddeus Crane (21) | 3895 Owagner Lane (17) |
| Beryl Hutchinson (16) | 4558 Twin Willow Lane (21) |
Furthermore, assume:
- Each variable-sized field needs 2 additional bytes besides raw storage.
- Each page has a fixed 12-byte page header.
- Records are stored as row store (NSM).
- Records can span multiple blocks; no extra overhead besides record storage.
- Records can be placed one after another with no additional overhead.
Page 1
Page 2
Page 3
Page 4
Page N
How many pages are required if the page size is 256 bytes?
03
CLOCK (Second Chance): final cache content
Guided checkpoint
Consider the CLOCK (a.k.a. Second Chance) algorithm. The system cache has space for 8 pages, and the current content of the cache is shown below.
When a page is accessed and already in cache, its reference bit is set to 1 (or remains 1). The clock hand does not move in that case.
The clock hand only moves when the accessed page is not in cache and the algorithm searches clockwise for a victim to evict. A newly inserted page gets reference bit 1.
Red boxes indicate reference bit = 1, orange boxes indicate reference bit = 0.
Request sequence:
81, 15, 36, 6, 42, 3, 69, 55Fill the pages in the clock after the last request is completed (all pages in the sequence have been accessed).
Section 06
Can A1 be answered from the resulting tuples from A2? to How many cache misses occur with FIFO?
01
Can A1 be answered from the resulting tuples from A2?
Guided checkpoint
Consider the following queries A1 and A2:
A1: SELECT name FROM R WHERE age > 25
A2: SELECT * FROM R WHERE age > 4002
How many cache hits occur with FIFO?
Guided checkpoint
The cache can hold 3 pages and is initially empty. Consider the following page request sequence:
15, 4, 6, 15, 10, 11, 6, 9, 12, 1How many cache hits occur if the replacement policy is FIFO?
Cache Hit: page is found in cache. Cache Miss: page is not found; writes to empty cache are misses.
03
How many cache misses occur with FIFO?
Guided checkpoint
The cache can hold 3 pages and is initially empty. Consider the following page request sequence:
15, 4, 6, 15, 9, 11, 6, 12, 15, 9How many cache misses occur if the replacement policy is FIFO?
Cache Hit: page is found in cache. Cache Miss: page is not found; writes to empty cache are misses.
Section 07
How many cache hits occur with LRU? to Disk Summary: label A, B, C, D
01
How many cache hits occur with LRU?
Guided checkpoint
The cache can hold 3 pages and is initially empty. Consider the following page request sequence:
15, 4, 6, 15, 9, 11, 6, 9, 12, 1How many cache hits occur if the replacement policy is LRU?
Cache Hit: page is found in cache. Cache Miss: page is not found; writes to empty cache are misses.
02
Given this workload, which caching strategy is more efficient?
Guided checkpoint
A query plan has a burst access pattern: it accesses a particular section of data at a time and then never accesses that section again.
Choose one answer.
03
Disk Summary: label A, B, C, D
Guided checkpoint
Use the blank disk summary figure and assign the correct label to A, B, C, and D.

Select the correct term for each marker:
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.