Unit 11 of 12 · about 4 hours · explain
Row versus column layout, columnar files, zone maps and object-storage table metadata
Analytical copies of transactional data live in object storage as immutable columnar files. Skipping whole files and pages is what makes petabyte scans affordable.
You'll be able to
- Explain why analytical queries read fewer bytes from columnar files.
- Describe Parquet row groups, column chunks and footer metadata with the page index.
- Explain how zone maps skip data and how table metadata tracks immutable files.
Covers
Read
In this order, only the parts listed
0 of 3 done
- Data storage for analyticsDDIA 2e - Chapter 4 Storage and Retrieval
Chapter 4, Data Storage for Analytics, printed pp. 134-141: column-oriented storage with the fact-table example, storage and table format with Parquet and Iceberg, and data catalogs
- Parquet file layout and page indexApache Parquet File Format
File Format: the magic-number, column-chunk, row-group and footer-metadata layout diagram, then the Page Index page with ColumnIndex and OffsetIndex per-page min and max values
Read layout and page skipping only. Skip thrift field errata and nested-encoding detail; this unit needs the skipping mechanism, not encoder internals.
- HLD Handbook OLTP versus OLAP with columnar detailHLD Handbook - Storage Engines and Data Structures
Row vs column layout with the byte-count example, then compression tricks and vectorized execution
Stop at execution internals; query compilation and vectorization are beyond this unit.
Focus on
- A Parquet file groups rows into row groups and columns into column chunks, with footer metadata naming every chunk location. Readers consult the footer first and fetch only referenced chunks.
- When the writer emits the optional page index, it holds min and max statistics for each page. A predicate skips pages whose range cannot match, which is the zone-map mechanism under its Parquet name.
- Parquet files are immutable once written. A table format tracks which files form a table with schema, snapshots and time travel; a catalog tracks which tables form a database.
- Columnar wins when queries touch few columns across many rows. Point lookups that reassemble full rows across many chunks stay slower than row-store fetches.
Common mistakes · 3
- Treating Parquet files as mutable tables. Files are immutable; inserts and deletes arrive as new files plus table-metadata updates.
- Calling min-max skipping an index lookup. Skipping avoids I/O but still scans the surviving pages; it is not a point-index seek.
- Expecting min-max statistics to skip pages on an unsorted column. When values are spread at random, almost every page range overlaps the predicate, so sort or cluster on the filter column first.
Try it yourself
Closed-book, before checking anything
Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.A query filters on a sorted column with per-page min and max values. Which pages are read?Answer
Only pages whose min-max range overlaps the predicate. The reader binary-searches ordered ranges or scans unordered ranges and skips the rest.
2.Why does footer-first reading matter for object storage?Answer
The footer names every column-chunk offset, so the reader fetches only referenced chunks over range requests instead of downloading whole files.
3.What do a storage format, a table format and a catalog each define?Answer
The storage format encodes rows as bytes in files. The table format names which files plus schema form a table with snapshots. The catalog names which tables form a database.
4.A point lookup by key needs the full row. Why might the columnar copy be slower than the row store?Answer
It must fetch and stitch one position from every referenced column chunk. The row store reads one contiguous tuple instead.
Practice
- HLD Handbook OLTP versus OLAP exercise: split a struggling Postgres service
Exercise: the 500M-row dashboard service with the Postgres plus CDC plus warehouse solution
Recompute the 100 GB raw to 20-30 GB compressed estimate yourself before opening the solution, then name the acceptable lag for your dashboard.
You're done when
You sketch the file, page-index and table-metadata layers for a new analytical copy and justify each skipping decision.
Only when you can do this without notes.
Leads to
- Append-only segmented logs, offsets, sparse indexes, retention and compactionSegments, retention and compaction reappear in the partitioned log.
- A crash-safe key-value store with crash and corruption injection and model-based testsYour crash-safe store stays row-oriented; state why that is the correct scope.
Notes
Resources · 3 for this unit, 10 more in the section
- 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.
- 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.
Also in this 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. - Hypothesis - Stateful TestingHypothesis · support
Use
RuleBasedStateMachinewith 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.
- Linux man-pages: fsyncLinux man-pages project · support
Read the DESCRIPTION for what
fsyncandfdatasyncguarantee and the directory-sync requirement for new file names, and the ERRORS section for what anEIOfrom write-back can refer to.