Unit 1 of 12 · about 4 hours · explain

Point, range and analytical workloads, OLTP versus OLAP, and records, pages and segments

Every engine choice later in this section is a bet on workload shape. A point lookup, a range scan and a full-table aggregation stress different parts of the storage stack.

You'll be able to

  • Classify a workload as point, range or analytical access and state which layout serves each shape.
  • Contrast OLTP and OLAP access patterns by rows touched, concurrency and latency target.
  • Explain how records pack into pages and how pages group into segments or files.

Covers

Workload shape for point, range and analytical accessRecords, pages, blocks and segmentsOLTP versus OLAP access patterns
1

Read

In this order, only the parts listed

0 of 3 done

  1. Storage engines for OLTP and analyticsDDIA 2e - Chapter 4 Storage and Retrieval

    Chapter 4, Storage and Retrieval: the chapter introduction and Storage and Indexing for OLTP, printed pp. 115-116, then Data Storage for Analytics, printed pp. 134-136

  2. CMU 15-445 Fall 2025 storage lecturesCMU 15-445 - Storage, Index and Recovery Sequence

    Lecture #03: Database Storage I, then Lecture #05: Database Storage II and Lecture #06: Storage Models and Compression

    Use these for pages, heap layout and row versus column models. Leave buffer-pool replacement and B+ tree operations for their own units.

  3. HLD Handbook storage and OLTP versus OLAPHLD Handbook - Storage Engines and Data Structures

    Workload shapes table and Row vs column layout, with the four-column Alice, Bob and Carol example

    Treat the vendor latency and compression ranges as reported figures, never as targets for your machine.

2

Focus on

  • Point access touches one to a hundred rows by key. Range access walks keys in order. Analytical access scans millions of rows and aggregates a few columns.
  • OLTP means thousands of short transactions per second with 1 to 10 ms targets. OLAP means a few heavy queries with seconds to minutes targets.
  • A row store keeps each tuple contiguous for cheap point access. A column store keeps each attribute contiguous so an aggregation reads only the columns it needs.
  • Records pack into fixed-size pages, and pages group into segments or files that higher units compact and index.
Common mistakes · 3
  • Calling OLTP and OLAP database brands. They are workload shapes; one product can serve either shape badly.
  • Assuming a row store plus an index matches a column store on wide scans. The column store reads fewer bytes by construction.
  • Assuming hybrid engines remove the trade-off. A second physical copy with a replication lag replaces it.
3

Try it yourself

Closed-book, before checking anything

Without notes, fill a decision table for three workloads: key-value point lookups, ordered range scans, and a full-table sum over 3 of 50 columns. Name the layout for each and show that, with equal-width columns, the aggregation reads about 6% of the row-store bytes before compression.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.A fact table has 50 equal-width columns and a query sums 3 of them over all rows. About what fraction of the row-store bytes does a column store read?Answer

    About , or 6%, before compression. The row store reads every column of every row; the column store reads only the three referenced columns.

  2. 2.Why does a point lookup favor a row store while a full-table aggregation favors a column store?Answer

    The row store keeps one tuple contiguous, so one lookup reads one place. The aggregation touches few columns across many rows, so contiguous columns read fewer bytes.

  3. 3.What distinguishes a page from a segment in this section?Answer

    A page is a fixed-size unit such as 8 KiB that the engine reads and writes. A segment is a larger immutable file of many pages that the log and LSM units write once and later compact.

  4. 4.A workload issues thousands of single-row updates per second and one nightly full-table report. Which shape dominates engine choice?Answer

    The updates dominate. Choose the engine for the sustained write and point-access shape, and serve the report from a separate analytical copy instead of compromising the write path.

5

Practice

  • CMU 15-445 Fall 2025 Homework #2: Slotted Pages and Log-Structured Storage

    Question 1, Slotted Pages and Log-Structured Storage: the slotted-page problems and the log-structured versus slotted-page comparison

    Work Question 1 on paper, then check your answers on the course's Gradescope site for non-CMU learners (entry code in the course FAQ). Keep Questions 2 and 3 on storage models and compression for their units.

You're done when

You classify a new workload by shape in one minute and defend the layout with a byte-count argument.

Only when you can do this without notes.

Leads to

Notes

Resources · 3 for this unit, 10 more in the section
  • CMU 15-445 - Storage, Index and Recovery SequenceCarnegie Mellon Database Group · primary

    Follow Fall 2025 lectures 3 to 10 and 21 to 22. Do the BusTub projects from tag v20251119-2025fall (https://github.com/cmu-db/bustub/tree/v20251119-2025fall): P1 (ARC replacer, disk scheduler and buffer pool manager) and P2 (B+ tree with a leaf tombstone buffer), with P0 (Count-Min Sketch) as the C++ warm-up. Tests ship with a DISABLED_ prefix to remove, and GCC 15 needs -DCMAKE_CXX_FLAGS="-include cstdint" at configure time. Use the storage and recovery homework for WAL reasoning, and keep C++ scope bounded to storage and recovery.

  • DDIA 2e - Chapter 4 Storage and RetrievalMartin Kleppmann and Chris Riccomini · required

    Read "Storage and Indexing for OLTP" (log-structured storage, B-trees, their comparison and secondary indexes) and "Data Storage for Analytics" (column-oriented storage). Its Bloom filter, tombstone and write-ahead log coverage is brief, so take those from OSTEP and The Internals of PostgreSQL. Build a workload decision table, then connect each claim to a measurement from your small store.

  • HLD Handbook - Storage Engines and Data StructuresHLD Handbook · required

    Read Part 0 data structures plus Part 4 storage engines and OLTP versus OLAP. Use its exercises for comparison, while the CMU project and local fault tests remain the implementation evidence.

Also in this section

  • Hypothesis - Stateful TestingHypothesis · support

    Use RuleBasedStateMachine with rules, bundles and invariants to drive your store and a dictionary model with the same random operation sequences, and check the machine catches a planted bug before trusting a pass.

  • Building Distributed Systems - The Logger and IndexesBuild Distributed Systems · optional

    Only the first three tasks are free (a write-ahead log, its recovery and log segments). Tasks are graded in the browser after login, so treat a pass as a drill and keep your local harness as the evidence.

  • The Internals of PostgreSQL - Buffer Manager, WAL and RecoveryHironobu Suzuki · support

    Read Chapter 1 Sections 1.2 to 1.4 (heap pages and tuples), Chapter 8 (buffer manager and dirty-page flushing) and Chapter 9 Sections 9.1 to 9.8 (WAL segments, XLOG records, checkpoints and recovery). Compare each mechanism with your simplified store. The site is revised often, so note the date you read it.

  • PostgreSQL 18 Documentation - WAL Configuration and InternalsPostgreSQL Global Development Group · support

    Read "WAL Configuration" (checkpoints and the redo point crash recovery starts from), "WAL Internals" and "Reliability" for the official, versioned statement of the write-ahead and durability contract.

  • Operating Systems: Three Easy Pieces - Crash Consistency and Data IntegrityRemzi and Andrea Arpaci-Dusseau · required

    Read Chapter 42 (FSCK and journaling: the crash scenarios, data and metadata journaling and their write order) and Chapter 45 (data integrity: checksums, misdirected and lost writes, scrubbing; https://pages.cs.wisc.edu/~remzi/OSTEP/file-integrity.pdf). Turn each crash scenario into an injection point in your store.

  • ARIES: A Transaction Recovery Method (Mohan et al., 1992)ACM TODS (Stanford course copy) · support

    Read the introduction, the overview and restart processing (analysis, redo by repeating history, undo) and the page LSN rule. The rest is 1992 storage detail beyond this section.

  • Build Your Own RedisBuild Your Own · optional

    Use the persistence and data-structure portions only if a second implementation is needed to cement parsing, indexing or append-log behavior. Do not replace the crash-tested stage artifact with tutorial completion.

  • Replicated Log and Stream Processor - Storage SliceRoadmap-Final · support

    Implement checksummed segments, indexes, acknowledgement states, recovery, retention and atomic metadata changes. Preserve every crash schedule and corrupted artifact needed to reproduce a failure.

  • Apache Parquet File FormatApache Software Foundation · support

    Read the File Format layout (row groups, column chunks, footer metadata) and the Page Index page (ColumnIndex and OffsetIndex with per-page min and max values for page skipping). Use it only for file layout and skipping; it does not cover table metadata or catalogs.

  • Linux man-pages: fsyncLinux man-pages project · support

    Read the DESCRIPTION for what fsync and fdatasync guarantee and the directory-sync requirement for new file names, and the ERRORS section for what an EIO from write-back can refer to.