โ† Database Technology

Learn / Database Technology

DBT: 2 - Data Layout

Practice questions on storage linearization, page/record layouts, NSM/DSM/PAX, and alignment calculations.

Learning path

0%

0 of 11 sections marked complete ยท about 53 minutes

Learning objectives

What you will be able to explain

  • What is the process of converting a multi-dimensional relation into a sequence of values called?
  • A standard database page typically consists of which two main portions?
  • Match transformation term to definition
  • Sequential vs random access speedup
  • Record headers: True or False
  • Which statement about memory vs disk addressability is correct?

Section 01

What is the process of converting a multi-dimensional relation into a sequence of values called? to Match transformation term to definition

01

What is the process of converting a multi-dimensional relation into a sequence of values called?

Correct answer: Linearization.

02

A standard database page typically consists of which two main portions?

Correct answers: Page Header and Data Portion.

Guided checkpoint

Select all that apply.

03

Match transformation term to definition

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

Section 02

Sequential vs random access speedup to Which statement about memory vs disk addressability is correct?

01

Sequential vs random access speedup

Correct answer: approximately 80x.

Guided checkpoint

A relation with 1024 blocks takes 11 s when random and 139 ms when sequential. Compute speedup = random_time / sequential_time.

02

Record headers: True or False

Answers: True, True, True, False.

Guided checkpoint

Mark each statement as True or False.

03

Which statement about memory vs disk addressability is correct?

Correct answer: memory is byte-addressable, disk typically block-addressable.

Section 03

Fixed-length record size to What is the purpose of the `slotID` in a slotted page structure?

01

Fixed-length record size

Correct answer: 34 bytes. **Path of Calculation:** 1. Name: 30 bytes 2. Age: 2 bytes 3. State: 2 bytes 4. Total = `30 + 2 + 2 = 34 bytes`

Guided checkpoint

Calculate the total size of a record for the following SQL schema:

CREATE TABLE Citizens (Name CHAR(30), Age SMALLINT, State CHAR(2))

Assume SMALLINT is 2 bytes, no padding and no header. Compute total bytes.

02

4-byte alignment size calculation

Correct answer: 36 bytes. **Path of Calculation:** 1. Name(30 bytes) -> Padded to 32 bytes to reach the next 4-byte boundary. 2. Age(2 bytes) + State(2 bytes) = 4 bytes(already aligned). 3. Total = `32 + 4 = 36 bytes`.

Guided checkpoint

Given a record with a 30-byte `CHAR`, a 2-byte `SMALLINT`, and a 2-byte `CHAR`, calculate the total size if the system uses **4-byte alignment** (padding the fields to the nearest 4-byte boundary).

03

What is the purpose of the `slotID` in a slotted page structure?

Correct answer: offset/index within a page.

Section 04

How does a record layout typically handle variable-length attributes (like a long `VARCHAR`) to keep the primary record size fixed? (Select all that apply) to What is pointer swizzling?

01

How does a record layout typically handle variable-length attributes (like a long `VARCHAR`) to keep the primary record size fixed? (Select all that apply)

Correct answers: A and C.

Guided checkpoint

Select all that apply.

02

When is a spanned record structure used?

Correct answer: for records that do not fit comfortably in a single page.

03

What is pointer swizzling?

Correct answer: convert stored references to direct memory pointers.

Section 05

Match insertion requirement to DBMS action to N-ary Storage Model (NSM) is commonly known as which layout?

01

Match insertion requirement to DBMS action

Correct mapping: 1-A, 2-B.

02

What is a tombstone in record deletion?

Correct answer: marker for stable references after movement/deletion.

03

N-ary Storage Model (NSM) is commonly known as which layout?

Correct answer: Row-Layout.

Section 06

Decomposition Storage Model (DSM) is commonly known as which layout? to Which layout is generally preferred for OLTP workloads?

01

Decomposition Storage Model (DSM) is commonly known as which layout?

Correct answer: Column-Layout.

02

Typical disadvantages of column layout (DSM)

Correct answers: A, C, D.

Guided checkpoint

Select all that apply.

03

Which layout is generally preferred for OLTP workloads?

Correct answer: Row-Layout (NSM).

Guided checkpoint

Online Transaction Processing

Section 07

Which layout is generally preferred for OLAP with few attributes accessed? to What does PAX stand for in hybrid layouts?

01

Which layout is generally preferred for OLAP with few attributes accessed?

Correct answer: Column-Layout (DSM).

Guided checkpoint

Online Analytical Processing

02

What is the fractured mirrors approach?

Correct answer: two replicas, one NSM and one DSM.

03

What does PAX stand for in hybrid layouts?

Correct answer: Partition Attributes Across.

Section 08

PAX characteristics: True or False to Record reconstruction cost

01

PAX characteristics: True or False

Answers: True, True, True, False.

Guided checkpoint

Mark each statement as True or False.

02

Inter-record spatial locality (Yes/No)

Correct mapping: NSM=No, DSM=Yes, PAX=Yes.

Guided checkpoint

Rank the inter-record spatial locality for the following layouts (Yes/No):

03

Record reconstruction cost

Correct mapping: NSM=Low, DSM=High, PAX=Low.

Section 09

According to the slides, what determines the best data layout? to What does HTAP stand for?

01

According to the slides, what determines the best data layout?

Correct answer: the workload determines the best layout.

02

Beyond layout, which aspects are important for performance?

Correct answers: A, B, C, E.

Guided checkpoint

Select all that apply.

03

What does HTAP stand for?

Correct answer: Hybrid Transactional and Analytical Processing.

Section 10

What was the key takeaway from the M1 traversal experiment? to Memory alignment with header

01

What was the key takeaway from the M1 traversal experiment?

Correct answer: traversal and layout must go hand-in-hand.

02

Storing together only the attributes that are frequently used together in a workload is known as:

Correct answer: Vertical Partitioning.

03

Memory alignment with header

Correct answer: 16 bytes.

Guided checkpoint

Calculate the total size of a record with: 8-byte Header, 4-byte Integer, 1-byte Boolean

Assume **4-byte alignment** is required for each field following the header.

Section 11

OLTP vs. OLAP: classify each statement

01

OLTP vs. OLAP: classify each statement

OLTP emphasizes frequent short transactions, normalized models, and low latency. OLAP emphasizes larger analytical queries, denormalized models, and historical analysis.

Guided checkpoint

Drag each sentence card from the deck to either OLTP or OLAP.

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.