Block and Record Addresses and Variable Length Records




CS157b

Chris Pollett

Feb 6, 2023

Outline

Introduction

Representing Data Elements IV

Fixed-Length Records

Record Headers

Sometimes we need to store additional information besides the value of each field. This data could be things like:

  1. The record schema or a pointer to it.
  2. The length of the record
  3. Timestamp indicating when the data was last modified or read.

Schema Info

MovieStar Record Layout Example

Record:schema reflengthtimestampnameaddressgenderbirthdate
Byte positions:0481244300304316

Packing Fixed-Length Records into Blocks

Block and Record Addresses

Client-Server Systems

Client Server Systems (cont'd)

There are several ways to represent addresses in the database address space:

Quiz

Which of the following statements is true?

  1. Rotational latency is the time to position head to correct cylinder.
  2. Checksums can be used to prevent intermittent disk failures causing bogus data from being used.
  3. RAID 5 uses a dedicated parity disk.

Logical Addresses

Structured Addresses

Advantages of this Scheme

Pointer Swizzling

A table show DB address and memory addresses used for swizzling

Pointer Swizzling Example

Records within a block before and after swizzling

Types of Swizzling

Returning Blocks to Disk

Pinned Records and Blocks

Keeping track of which bblocks use a particular swizzling.

Records with Variable Length Fields

Records with Repeating Fields

Variable Format Records

Records that do not fit in Blocks