Highlights

Contents

Part I
01

OLTP vs OLAP

We begin with a score transaction and a season-wide question. They need different access patterns even when they describe the same sport. We will separate OLTP from OLAP, keep a source of truth, and derive an analytical copy with a measurable freshness contract.

CHAPTER ATLAS / FOLLOW THE READING PATHCHAPTER ATLAS / FOLLOW THE READING PATH1OLTP vs OLAP2Batch processing3Stream processing4Event time, windows,watermarks5ETL, ELT, warehouses, andlakes6CDC and materializedviews7Checkpoints andexactly-once8Spark and Flink9Case study: score toreport

#Section 1A single update and a million-row question

A scorer records one run. The transaction checks one match and changes a small set of records. Later, an analyst asks for total runs by team across the season. That query can read a large fraction of the history. Serving both workloads on the same unconstrained path lets a large scan delay the live score update.

Online transaction processing, or OLTP, serves operational actions such as creating a record or updating a score with transactional rules. Online analytical processing, or OLAP, serves questions across many records, often grouping and aggregating their values. These names describe workloads and design goals, not a prohibition on a database supporting both.

OLTP TOUCHES ONE ROW FAST; OLAP SCANS A SEASON. KEEP THEM APARTOLTP TOUCHES ONE ROW FAST; OLAP SCANS A SEASON. KEEP THEM APARTOLTP: update match m7one row, a few millisecondsOLAP: sum the seasonevery row, one column
Figure 17.1Illustrative workload comparison. The distinction is the work performed, not whether the system happens to use SQL.

An analytical copy can be tuned for large reads without putting every scan on the transactional database. That choice adds synchronization, lag, schema evolution, and recovery work. Begin by naming the question, acceptable delay, and consistency requirement. A separate warehouse is useful when it solves those requirements, not because every system needs another box.

#Section 2Row storage and column storage read different bytes

A report row occupies an illustrative 500 bytes, but the analyst needs only an eight-byte numeric field. A row-oriented layout places much of each record together, making a complete record convenient to retrieve or change. A column-oriented layout places values of one field together, making a narrow-field scan convenient.

For a million rows, reading every 500-byte record touches 500,000,000 bytes under the simple exercise. Reading one eight-byte column touches 8,000,000 raw bytes. Dividing gives 62.5 times fewer raw field bytes. This ignores compression, indexes, headers, and storage pages, so it is an access-volume comparison rather than a measured speedup.

COLUMN LAYOUT READS THE FIELD NEEDED BY THE QUESTIONCOLUMN LAYOUT READS THE FIELD NEEDED BY THE QUESTIONrow-orientedcolumn-orientedfull rows: 500,000,000 Bone column: 8,000,000 Billustrative layout cutaway; full workload bytes shown below
Figure 17.2Computed illustrative raw-byte scan comparison. Both layouts can have indexes, compression, and other optimizations beyond this exercise.

A query needing several columns reads their combined representation, while a predicate can require additional fields before it knows which rows qualify. Sorting and grouping can also allocate intermediate state. The narrow-column calculation isolates one mechanism. It should not be presented as the total query cost when the query actually performs joins, filters, or multiple aggregations.

Column values often share type and nearby patterns, which can help compression and vectorized processing. Frequent small updates can require another write path or compaction strategy. Row-oriented systems can answer analytics, and column systems can support point access, but their physical tradeoffs differ. Explain data layout before repeating a product label.

#Section 3Freshness belongs to the derived answer

An analyst sees a total of ten even though another accepted run has reached the transactional database. The answer may be correct for an earlier source position but stale for the latest one. Pipeline lag measures how far the derived processing is behind a named source progress boundary.

A useful result can include an as-of position or freshness timestamp. The pipeline captures accepted changes, transforms them, and commits an analytical result. A producer’s event timestamp is not automatically proof that every earlier change has been included. Source progress, processing progress, and result publication need compatible definitions.

EVERY ANALYTICAL ANSWER SAYS "AS OF" SOME SOURCE POSITIONEVERY ANALYTICAL ANSWER SAYS "AS OF" SOME SOURCE POSITION…840841842843844845capturedprocessedpublished total"red = 7 as of position 842" is a complete answer; "red = 7" is not
Figure 17.3Illustrative progress boundaries. The output reports which accepted history it represents.

Measure the age of the oldest unprocessed accepted record or a comparable source watermark, with clock assumptions stated. If inputs can arrive late, result finality needs another policy beyond ingestion lag. A pipeline caught up to its transport offsets can still be missing late business events that have not yet arrived. The time part later separates those two questions.

#Section 4Derived data should be reproducible

A transformation bug counts a correction twice. The warehouse has plausible numbers, but there is no easy way to determine their source history. A data pipeline is the controlled path that captures, transforms, stores, and publishes data with progress and recovery rules. Reproducibility requires input identity, transformation version, and output meaning.

Keep raw accepted records or another authoritative history according to retention and privacy requirements. Attach source positions and schema versions. A repaired transformation can then rebuild the affected result from known inputs. Do not assume the last output alone contains enough information to reverse every processing error.

KEEP RAW HISTORY AND A VERSIONED TRANSFORM, AND ANY OUTPUT CAN BE REBUILTKEEP RAW HISTORY AND A VERSIONED TRANSFORM, AND ANY OUTPUT CAN BE REBUILTraw historyaccepted recordstransform v7versioned codeoutput gen 12identifiedreconcilevs sourceretention and deletion rules limit which rebuilds stay possible
Figure 17.4Illustrative reproducible pipeline. Retention and deletion policies constrain which rebuilds remain possible.

A transformation should be deterministic under its stated dependencies. If it looks up the current team name during replay, historical results can differ from the original run. Either version that reference data or state that the output deliberately uses current names. Hidden mutable dependencies turn a replay into a new calculation rather than a reconstruction.