Skip to content

Diogo TravassosData leadership · Analytics · Decision-making

Public dataSynthetic faults

Data quality scorecard · pipeline cost

On one month of public trip data, a full rebuild used 2.0 to 2.3 times the transform CPU of the incremental layouts (1.9 to 3.0 over five paired runs against the 3-day window) and read 5.4 times the data of the 3-day window, which published the same numbers as the full rebuild on five declared faults, as its design implies, and never applies late or backfilled rows once their day has left the window.

The five incremental layouts used 6.6 to 7.5 transform CPU seconds over the month, within each other's run-to-run range, against 15.1 for the full rebuild, which was the dearest in each of the five runs; counting the landing step every layout shares, the full rebuild used 2.08 times the CPU of the window. What drives the gap is history: a full rebuild re-reads the whole landing table, so its run grew from 0.14 to 0.89 CPU seconds over the month while the window's ended at 0.22. Merging on the trip ID cost about the same and read less data, but left the cleaned table two days short after the bad restore. Adding each file's totals to the published table, the pipeline recovery part's design with its watermark guard removed, double-counted the replay and the backfill.

Key figures
Full rebuild against the incremental layouts2.0 to 2.3 times the transform CPU1.9 to 3.0 in five paired runs against the 3-day window, with 5.4 times its data read and 5.4 times its data writtenKept published numbers right, as designed5 of 6 layoutsthrough late rows, a replay, a backfill run twice and a bad restore, with no manual step, as each layout's design implies; a renamed column parked 6 files in every layout; adding file totals, the recovery part's design with its guard removed, got two wrongLate-data window, 1 to 7 days0.9 to 5.4 MB readover the month (4.5 to 8.7 CPU seconds); the 1-day window's runs never applied the 60 late January 24 rows, the 3-day and 7-day windows didThree small files a day2.9 times the datascanned by a month-wide query without compaction (352 KB against 122 KB; 93 files against 31)

Main limitation One month of 10,000 public trips in a small local lakehouse on one shared machine (16 threads, load average 48 to 152). Times carry run-to-run noise and fixed per-run costs dominate at this size, so the ratios, not the seconds or the cents, are the result.

What each layout cost

A full rebuild's run grows with every day of history; an incremental run stays nearly flat.

CPU seconds per run, one run per daily file, median of five runs.

Full rebuild3-day windowMerge on trip ID

CPU seconds per run over the month, by layoutFull rebuild from 0.14 to 0.89 s per run; 3-day window from 0.11 to 0.22 s; merge on trip ID from 0.14 to 0.21 s.0.000.250.500.751.00Jan 1Jan 8Jan 15Jan 22Jan 29Trip day of the run (one daily file each)Full rebuildIncrementalJanuary 1, 1 day of history: full rebuild 0.14 s, 3-day window 0.11 s, merge on trip ID 0.14 s of CPU per run, median of five runsJanuary 2, 2 days of history: full rebuild 0.15 s, 3-day window 0.13 s, merge on trip ID 0.13 s of CPU per run, median of five runsJanuary 3, 3 days of history: full rebuild 0.17 s, 3-day window 0.18 s, merge on trip ID 0.14 s of CPU per run, median of five runsJanuary 4, 4 days of history: full rebuild 0.17 s, 3-day window 0.16 s, merge on trip ID 0.16 s of CPU per run, median of five runsJanuary 5, 5 days of history: full rebuild 0.22 s, 3-day window 0.17 s, merge on trip ID 0.16 s of CPU per run, median of five runsJanuary 6, 6 days of history: full rebuild 0.22 s, 3-day window 0.15 s, merge on trip ID 0.17 s of CPU per run, median of five runsJanuary 7, 7 days of history: full rebuild 0.23 s, 3-day window 0.19 s, merge on trip ID 0.18 s of CPU per run, median of five runsJanuary 8, 8 days of history: full rebuild 0.26 s, 3-day window 0.20 s, merge on trip ID 0.18 s of CPU per run, median of five runsJanuary 9, 9 days of history: full rebuild 0.36 s, 3-day window 0.21 s, merge on trip ID 0.21 s of CPU per run, median of five runsJanuary 10, 10 days of history: full rebuild 0.40 s, 3-day window 0.20 s, merge on trip ID 0.23 s of CPU per run, median of five runsJanuary 11, 11 days of history: full rebuild 0.35 s, 3-day window 0.17 s, merge on trip ID 0.19 s of CPU per run, median of five runsJanuary 12, 12 days of history: full rebuild 0.36 s, 3-day window 0.16 s, merge on trip ID 0.20 s of CPU per run, median of five runsJanuary 13, 13 days of history: full rebuild 0.35 s, 3-day window 0.16 s, merge on trip ID 0.20 s of CPU per run, median of five runsJanuary 14, 14 days of history: full rebuild 0.42 s, 3-day window 0.17 s, merge on trip ID 0.19 s of CPU per run, median of five runsJanuary 15, 15 days of history: full rebuild 0.42 s, 3-day window 0.24 s, merge on trip ID 0.21 s of CPU per run, median of five runsJanuary 16, 16 days of history: full rebuild 0.50 s, 3-day window 0.20 s, merge on trip ID 0.22 s of CPU per run, median of five runsJanuary 17, 17 days of history: full rebuild 0.46 s, 3-day window 0.19 s, merge on trip ID 0.20 s of CPU per run, median of five runsJanuary 18, 18 days of history: full rebuild 0.47 s, 3-day window 0.20 s, merge on trip ID 0.21 s of CPU per run, median of five runsJanuary 19, 19 days of history: full rebuild 0.53 s, 3-day window 0.26 s, merge on trip ID 0.26 s of CPU per run, median of five runsJanuary 20, 20 days of history: full rebuild 0.67 s, 3-day window 0.26 s, merge on trip ID 0.27 s of CPU per run, median of five runsJanuary 21, 21 days of history: full rebuild 0.60 s, 3-day window 0.19 s, merge on trip ID 0.24 s of CPU per run, median of five runsJanuary 22, 22 days of history: full rebuild 0.62 s, 3-day window 0.21 s, merge on trip ID 0.23 s of CPU per run, median of five runsJanuary 23, 23 days of history: full rebuild 0.63 s, 3-day window 0.22 s, merge on trip ID 0.24 s of CPU per run, median of five runsJanuary 24, 24 days of history: full rebuild 0.77 s, 3-day window 0.23 s, merge on trip ID 0.26 s of CPU per run, median of five runsJanuary 25, 25 days of history: full rebuild 0.84 s, 3-day window 0.23 s, merge on trip ID 0.26 s of CPU per run, median of five runsJanuary 26, 26 days of history: full rebuild 0.72 s, 3-day window 0.24 s, merge on trip ID 0.24 s of CPU per run, median of five runsJanuary 27, 27 days of history: full rebuild 0.71 s, 3-day window 0.21 s, merge on trip ID 0.29 s of CPU per run, median of five runsJanuary 28, 28 days of history: full rebuild 0.89 s, 3-day window 0.25 s, merge on trip ID 0.26 s of CPU per run, median of five runsJanuary 29, 29 days of history: full rebuild 0.90 s, 3-day window 0.24 s, merge on trip ID 0.24 s of CPU per run, median of five runsJanuary 30, 30 days of history: full rebuild 0.93 s, 3-day window 0.28 s, merge on trip ID 0.30 s of CPU per run, median of five runsJanuary 31, 31 days of history: full rebuild 0.89 s, 3-day window 0.22 s, merge on trip ID 0.21 s of CPU per run, median of five runs
Show the data
Each layout over the month of daily files (31 runs), median of five runs
LayoutCPUCPU rangeData readData writtenFiles touched
Full rebuild15.1 s14.0 to 19.713.3 MB12.9 MB2,418
3-day window6.6 s5.8 to 8.12.5 MB2.4 MB388
Merge on trip ID7.0 s5.8 to 8.11.6 MB0.8 MB124
Merge, adding totals6.6 s6.2 to 7.90.9 MB0.8 MB93
Merge, unpartitioned7.5 s6.4 to 7.91.6 MB0.8 MB124
Merge, compacted7.4 s6.5 to 9.31.6 MB0.8 MB124
1-day window4.5 s3.8 to 4.90.9 MB0.8 MB93
7-day window8.7 s8.0 to 9.45.4 MB5.2 MB918

CPU is the transform step; the landing step every layout shares is counted apart. Data read and written count the data files each run opened and added, not the table's own commit log.

The full rebuild's run grew by about 0.027 CPU seconds for each day of history it re-read; the incremental runs grew by 0.003 to 0.006, from opening tables with longer histories. On the first day every layout costs about the same, because opening tables and writing commits is most of the work on a file of about 300 trips.

With three smaller files a day (93 runs), the gap widened: the full rebuild used 3.4 times the CPU of the 3-day window (2.7 to 3.7 over five paired runs, under uneven load: in the first run the full rebuild started at a load average of 64 and the window at 137) and read 6.0 times the data, because it re-read the whole history three times a day.

The same month as three files a day (93 runs), median of five runs
LayoutCPUData readCleaned table files
Full rebuild117.7 s58.1 MB31
3-day window34.6 s9.7 MB31
Merge on trip ID35.7 s4.5 MB93
Merge, adding totals27.0 s2.5 MB93
Merge, unpartitioned37.1 s4.7 MB93
Merge, compacted31.8 s5.6 MB31

What the cheaper layouts gave up

The same layouts ran through five faults from the pipeline recovery part, each on its own month. Each cell is the state at the clock (06:00 on February 1, 2024), before anyone intervenes. These outcomes follow from what each layout does; the runs confirm them rather than discover them.

Published and cleaned tables against the clean month, at the clock, five runs each with the same outcome
LayoutLate rowsReplay after an outageBackfill run twiceRenamed columnBad restore
Full rebuildRightRightRight6 days missing: 6 files parkedRight
3-day windowRightRightRight6 days missing: 6 files parkedRight
Merge on trip IDRightRightRight6 days missing: 6 files parkedPublished right; cleaned table missing 2 days
Merge, adding totalsRightPublished numbers wrong on 1 dayPublished numbers wrong on 7 days6 days missing: 6 files parkedPublished right; cleaned table missing 2 days
Merge, unpartitionedRightRightRight6 days missing: 6 files parkedPublished right; cleaned table missing 2 days
Merge, compactedRightRightRight6 days missing: 6 files parkedPublished right; cleaned table missing 2 days

Adding each file's totals to the published table counted the replayed rows again (200 extra trips on January 30) and the backfill again (7 days doubled). The merge layouts that recompute a day from the cleaned table got both right, because a trip delivered twice is still one row there. The 3-day window got the replay right because it rebuilds each day from the landing table keeping one row per trip, and it never read the backfill: those days were already outside its window, and the rows were identical. The full rebuild keeps one row per trip the same way. The bad restore removed January 26 and 27 from the cleaned table; the published numbers stayed right in every layout because nothing recomputed those days, but every merge layout kept the cleaned table two days short, so an analyst querying it would have been wrong. The full rebuild put the days back on its next run, and the 3-day window did too, only because the two days were still inside its window.

The renamed column parked the last 6 files in every layout, so all six published 6 days short until the new schema was registered. Recovery was cheap everywhere: a control-totals comparison against the landing table, which found every wrong day in every layout and fault, cost 0.9 to 1.4 CPU seconds. For the renamed column, rebuilding only the days it found took 0.3 to 0.4 CPU seconds, against 1.0 for one full rebuild. After recovery every table in every layout matched the clean month.

That comparison rebuilds the landing table the way the full rebuild does, so it costs about one full rebuild run, and for the full rebuild layout it compares the layout with its own method. A cheaper daily check, measured after the results: counting distinct trip IDs per day in the landing table, against the cleaned table's rows and the published trips, flagged exactly the same days in all 7 cells tried, for 0.29 to 0.39 CPU seconds against 0.8 to 1.1 for the full comparison on the same tables (median of 3 runs each).

One trace: the window and the late rows

The last 60 January 24 trips land at 01:30 on January 27. At that moment the newest trip day in the landing table is January 26.

Over the month, the 1-day window used 4.5 s of CPU and read 0.9 MB; the 3-day window 6.6 s and 2.5 MB; the 7-day window 8.7 s and 5.4 MB. Each extra day of window re-reads one more day of data on every run, so the window is a price paid daily for lateness that may come once a month.

In plain words

A data pipeline can produce the same tables in very different ways. It can rebuild everything from the raw files every time a file lands, or touch only what the new file changes. The cheap way is cheaper every day, and the question a data lead has to answer is what it quietly gets wrong. I ran six layouts of the same pipeline on the same public month, measured what each cost to run and to query, then ran them through the faults from the pipeline recovery part.

Landing table
Every file as it arrived (bronze).
Cleaned table
One row per trip (silver), what analysts query.
Published table
The daily numbers a dashboard reads (gold).
Partition
A folder per trip date, so a query for one day can skip the rest.
Late-data window
How many recent days each run re-reads, so late rows still land.
Merge
Insert new trips and update known ones, matched on the trip ID.
Compaction
Rewriting many small files into one.
CPU seconds
Processor time the run used, the closest thing on one machine to what a warehouse bills.

Partitions and small files: the query side

Every layout returned the same answers to the six declared queries. What differed was how much data each query had to read to get them.

Data each query scanned and the files it opened, merge on trip ID in four storage setups, median of five runs
QueryPartitioned by dateUnpartitionedThree files a dayThree a day, compacted
Dashboard: last 7 days13 KB, 7 files53 KB, 31 files13 KB, 7 files13 KB, 7 files
Dashboard: month totals65 KB, 31 files71 KB, 31 files65 KB, 31 files65 KB, 31 files
Analyst: one day by area5 KB, 1 file107 KB, 31 files14 KB, 3 files5 KB, 1 file
Analyst: one week, fare per mile59 KB, 7 files143 KB, 31 files124 KB, 21 files54 KB, 7 files
Analyst: whole month, missing fares123 KB, 31 files137 KB, 31 files352 KB, 93 files122 KB, 31 files
Analyst: one trip by ID374 KB, 31 files379 KB, 31 files609 KB, 93 files263 KB, 31 files

Unpartitioned, a one-day query read 20.7 times the data and a one-week query 2.4 times, but that measures the reader more than the layout: DuckDB, given a plain list of files, opened every file to read its footer. A reader that uses the table log's file statistics would have left 1 of 31 files for the one-day query and 7 of 31 for the week (counted after the results), because the files stayed in date order. The pipeline itself cost the same either way. With three files a day and no compaction, the cleaned table held 93 small files, and a month-wide query read 2.9 times the data and used 3.0 times the CPU of the compacted table. A lookup of one trip by ID opened every file in every setup: partitioning by date does nothing for a key lookup.

One storage cost is easy to miss. The full rebuild replaces every file on every run, and the old files stay on disk until a cleanup removes them: after one month the cleaned table took 11.8 MB on disk for 0.8 MB of live data, 15.6 times as much.

What it is worth

Money here comes only from a declared price, set before the runs: US$4.00 per compute-hour of CPU, and US$5.00 per terabyte of data read, with each dashboard query run 24 times a day and each analyst query 10 times a day.

One month at the declared prices, on this data
LayoutPipelinePipeline and queries
Full rebuildUS$0.0168US$0.055
3-day windowUS$0.0073US$0.045
Merge on trip IDUS$0.0078US$0.047
Merge, adding totalsUS$0.0073US$0.044
Merge, unpartitionedUS$0.0083US$0.057
Merge, compactedUS$0.0083US$0.046

At 10,000 trips a month these are cents, and the queries are 69% or more of every total, so the absolute figures say little. The ranking is the result. The full rebuild's pipeline cost was above every incremental layout's at every price ratio tried (the price of data read moved from 10,000 times lower to 10,000 times higher), and with the queries added it ranked fifth of six at every ratio. The unpartitioned layout ranked last at every ratio because its queries went through a reader that opens every file; with a reader that uses the table log's statistics most of that gap would close. The four partitioned incremental layouts tie: they hold the same data, so their query costs differ only by timing noise, and their pipeline CPU differences are inside the run-to-run range. Only when data read is priced 1,000 times higher than declared or more, or alone, does an order appear among them: the 3-day window falls behind the merge layouts, because it re-reads three days on every run.

What a team should do with it

  1. Run incrementally, and recompute each published day from the cleaned table. Never add a file's totals to a published number: a replay or a backfill run twice counts the same trips again.
  2. Size the late-data window from measured lateness, the longest arrival lag in the landing table plus a margin, not from habit. Every extra day of window is re-read on every run.
  3. Keep the full rebuild as the recovery path, not the schedule. Check every day with per-day counts from the landing table against the cleaned and published tables, which here flagged every wrong day for a third of the CPU, and run the full metric-by-metric comparison weekly: it costs about as much as a full rebuild run, because it is one. A rebuild of only the flagged days put them back.
  4. Partition the cleaned table by the date people filter on, compact small files when a day closes, and clean up replaced files on a schedule.

The next part, lineage and SLOs, follows a change from the source down to the dashboards and measures which checks would have stopped it.

What should hold in a warehouse, and what should not

These are expectations from how each layout works, not measurements.

Limits

Use this at your company

To price the layouts of a pipeline of your own the same way, paste this prompt into an AI assistant that can query your warehouse.

This method comes from Diogo Travassos's study "Data quality scorecard: pipeline cost" (https://diogotravassos.dev/data-quality-scorecard/pipeline-cost.html). If you can open links, read it first: it works the method through end to end and shows the checks that caught mistakes. The steps below stand on their own if you can't.

Help me measure what each layout of my data pipeline costs to run and to query, and what the cheaper layouts give up, before we choose one.

Data you need from me: the raw landing table with a load time and batch ID on every row, the cleaned table keyed on a row ID, the published daily table, the queries our dashboards and analysts run most, and at least a month of load history.

Method:
1. Build the same pipeline in at least three layouts on a copy of that month: a full rebuild every run, an incremental run that replaces the last few days (a declared late-data window), and a merge on the row key that recomputes only the days it touched.
2. Replay the month's loads through each layout. For every run, record CPU seconds, the bytes of data files read and written, and the files touched. Run the query set at the end and record the data each query scans and the files it opens.
3. Repeat the whole replay at least five times and report the median and the range. Show the results as ratios between layouts, not only as seconds.
4. Replay it again with realistic faults: rows that arrive days late, a replay after an outage, a backfill run twice, a renamed column, a restore that goes too far back. After each, compare the published and cleaned tables with a clean rebuild, per day and metric.

Checks before trusting the answer:
- Confirm every layout produces the same published and cleaned tables on the clean month, and every query returns the same answer.
- Check that byte and file counts repeat exactly across runs; only times should vary.
- Price the result with a stated compute price and a stated price per byte scanned, then change their ratio by several orders of magnitude and say whether the ranking of layouts changes.

Report back: the cost ratio between a full rebuild and the cheapest incremental layout that kept the published numbers right, what each cheaper layout got wrong under which fault, which ratios you expect to hold on our full data volume and which you do not, and the limits: how much data, how many runs, and on what machine.

In your report, say which study you followed and link it: https://diogotravassos.dev/data-quality-scorecard/pipeline-cost.html

Method and checks

The layouts

All six share the pipeline recovery part's landing table, strict conform step (a missing column or a value that does not parse parks the whole file), schemas and load schedule. Only the cleaned and published tables, and the work each run does, change. Both tables are partitioned by trip date unless the layout says otherwise.

  • Full rebuild. Every run re-reads the whole landing table, keeps the latest row for each trip, and rewrites the cleaned and published tables.
  • 3-day window. Every run re-reads the last three trip days from the landing table and replaces those days in both tables. Rows for an older day are not applied until a recovery runs.
  • Merge on trip ID. Every run merges the new file into the cleaned table on the trip ID, then recomputes the published days the file touched.
  • Merge, adding totals. The same merge, but the published table adds the new file's daily totals instead of recomputing the day.
  • Merge, unpartitioned. Merge on trip ID with both tables unpartitioned, so only file statistics can skip files.
  • Merge, compacted. Merge on trip ID, plus the day's files in the cleaned table rewritten into one when the day's last file arrives.

A 1-day and a 7-day window ran as a sweep on the daily files and the late rows only.

Tools: deltalake 1.6.6, DuckDB 1.5.6, pyarrow 26.0.0, Python 3.12.3. Every table checkpoints its commit log every 10 commits.

Workloads and queries

Two clean months: one file per trip day at 01:00 the next day (31 runs), and each day as three files at 01:00, 01:10 and 01:20 (93 runs). The five faults each run on their own month of daily files. A run starts when a file lands. The six queries, run through DuckDB's parquet reader over the live files the table's log lists, five times each:

  • Dashboard: last 7 days
  • Dashboard: month totals
  • Analyst: one day by area
  • Analyst: one week, fare per mile
  • Analyst: whole month, missing fares
  • Analyst: one trip by ID

Every answer was compared with the same query on the clean month.

What was measured

CPU seconds of the pipeline process (all threads) for each run, apart from the landing step every layout shares. Data read: the bytes of the data files each run opened after partition and file-statistics pruning, including the files a merge scans and a compaction rewrites. Data written: the bytes of the data files its commits added. Files touched: files added, removed and opened. The operating system's byte counters, which also count commit logs, are in the results file. A query's data scanned is what DuckDB read during the scan; the files it opened come from its own query profile. Wall seconds are recorded too, but on a loaded machine they include time spent waiting for a processor, so CPU seconds are the measure. For the same reason the publish lag (wall time from a file landing to its rows in the published table) is in the results file but not shown.

Runs and machine

230 jobs: 6 layouts on 7 workloads plus the sweep, each repeated 5 times, each in a fresh process and folder. The repeats ran side by side, one process each, with the layouts rotated in each. Machine: AMD Ryzen 7 5800 8-Core Processor, 16 threads, 35 GB, Linux under Windows. No job failed, every outcome, pipeline data size and file count repeated exactly in all five runs, and every merge scanned exactly the files the pruning predicted.

Decided before the runs, and what changed

The layouts, workloads, queries, measures, prices and the headline rule were written down and committed before any measured run. Development runs then showed where the measures could not be taken as written, and eight changes were committed, still before any measured run: queries read the files through DuckDB's own parquet reader, because text columns written by a merge broke filtering through the other reader; commit logs checkpoint every 10 commits; CPU seconds replace wall seconds, because the machine was loaded; bytes count data files only; the landing step hands its manifest of files to the run in memory; the time spent counting files is taken out of each run; each batch of runs starts with an unrecorded warm-up job; and the repeats run side by side. The workloads ran in alphabetical order of their names rather than the order the design lists. The comparisons on this page (ratios, ranges, rankings) were computed after the runs from the same results. Two measurements were added after the results: the cheaper daily check and the files a reader using the table log's statistics would open.