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.
| 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 written | Kept 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 wrong | Late-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 did | Three 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
CPU seconds per run, one run per daily file, median of five runs.
Full rebuild3-day windowMerge on trip ID
Show the data
| Layout | CPU | CPU range | Data read | Data written | Files touched |
|---|---|---|---|---|---|
| Full rebuild | 15.1 s | 14.0 to 19.7 | 13.3 MB | 12.9 MB | 2,418 |
| 3-day window | 6.6 s | 5.8 to 8.1 | 2.5 MB | 2.4 MB | 388 |
| Merge on trip ID | 7.0 s | 5.8 to 8.1 | 1.6 MB | 0.8 MB | 124 |
| Merge, adding totals | 6.6 s | 6.2 to 7.9 | 0.9 MB | 0.8 MB | 93 |
| Merge, unpartitioned | 7.5 s | 6.4 to 7.9 | 1.6 MB | 0.8 MB | 124 |
| Merge, compacted | 7.4 s | 6.5 to 9.3 | 1.6 MB | 0.8 MB | 124 |
| 1-day window | 4.5 s | 3.8 to 4.9 | 0.9 MB | 0.8 MB | 93 |
| 7-day window | 8.7 s | 8.0 to 9.4 | 5.4 MB | 5.2 MB | 918 |
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.
| Layout | CPU | Data read | Cleaned table files |
|---|---|---|---|
| Full rebuild | 117.7 s | 58.1 MB | 31 |
| 3-day window | 34.6 s | 9.7 MB | 31 |
| Merge on trip ID | 35.7 s | 4.5 MB | 93 |
| Merge, adding totals | 27.0 s | 2.5 MB | 93 |
| Merge, unpartitioned | 37.1 s | 4.7 MB | 93 |
| Merge, compacted | 31.8 s | 5.6 MB | 31 |
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.
- Late rows. The last 60 January 24 rows arrive at 01:30 on January 27, after the day was published.
- Replay after an outage. Two January 30 micro-batches are delivered again, out of order, before the day closes.
- Backfill run twice. The stream for January 8 to 14 is run again at 04:00 on February 1.
- Renamed column. From the January 26 file the fare column arrives as fare_amount, so those files are parked.
- Bad restore. At 09:00 on January 28 the cleaned table is restored to its state after the January 25 file; the published table is left as it was.
| Layout | Late rows | Replay after an outage | Backfill run twice | Renamed column | Bad restore |
|---|---|---|---|---|---|
| Full rebuild | Right | Right | Right | 6 days missing: 6 files parked | Right |
| 3-day window | Right | Right | Right | 6 days missing: 6 files parked | Right |
| Merge on trip ID | Right | Right | Right | 6 days missing: 6 files parked | Published right; cleaned table missing 2 days |
| Merge, adding totals | Right | Published numbers wrong on 1 day | Published numbers wrong on 7 days | 6 days missing: 6 files parked | Published right; cleaned table missing 2 days |
| Merge, unpartitioned | Right | Right | Right | 6 days missing: 6 files parked | Published right; cleaned table missing 2 days |
| Merge, compacted | Right | Right | Right | 6 days missing: 6 files parked | Published 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.
- The 3-day window covers January 24 to 26, so that run re-reads all three days from the landing table and replaces them. January 24 is complete, and stays complete.
- A 1-day window covers only January 26. The 60 rows sit in the landing table and never reach the cleaned or published tables: at the clock January 24 is short 60 trips and US$820 of fares.
- The next morning's control-totals comparison flags January 24 alone. Rebuilding that one day from the landing table took 0.23 s of CPU and read 33 KB of data, and the day matched the clean month again.
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.
| Query | Partitioned by date | Unpartitioned | Three files a day | Three a day, compacted |
|---|---|---|---|---|
| Dashboard: last 7 days | 13 KB, 7 files | 53 KB, 31 files | 13 KB, 7 files | 13 KB, 7 files |
| Dashboard: month totals | 65 KB, 31 files | 71 KB, 31 files | 65 KB, 31 files | 65 KB, 31 files |
| Analyst: one day by area | 5 KB, 1 file | 107 KB, 31 files | 14 KB, 3 files | 5 KB, 1 file |
| Analyst: one week, fare per mile | 59 KB, 7 files | 143 KB, 31 files | 124 KB, 21 files | 54 KB, 7 files |
| Analyst: whole month, missing fares | 123 KB, 31 files | 137 KB, 31 files | 352 KB, 93 files | 122 KB, 31 files |
| Analyst: one trip by ID | 374 KB, 31 files | 379 KB, 31 files | 609 KB, 93 files | 263 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.
| Layout | Pipeline | Pipeline and queries |
|---|---|---|
| Full rebuild | US$0.0168 | US$0.055 |
| 3-day window | US$0.0073 | US$0.045 |
| Merge on trip ID | US$0.0078 | US$0.047 |
| Merge, adding totals | US$0.0073 | US$0.044 |
| Merge, unpartitioned | US$0.0083 | US$0.057 |
| Merge, compacted | US$0.0083 | US$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
- 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.
- 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.
- 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.
- 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.
- Data read and written: should hold, and grow. A full rebuild re-reads all history on every run, so its 5.4 times the data after 31 days grows in step with the days of history a team keeps.
- CPU: should grow towards the data ratio. Here most of a run is fixed work (opening tables, writing commits), which every layout pays, so the CPU ratio sits well below the data ratio. With millions of rows a day the per-row work dominates.
- Partitioned against unpartitioned: depends on the reader and the file layout. Here every unpartitioned file held one day, so a reader that uses the table log's statistics skips files as well as partitions do, and for a reader that opens every file the gap stays near one footer per file. It approaches the ratio of the table's size to a day's only when merges and late data mix days across files.
- Small files: should grow. Three files a day already cost a month-wide query 2.9 times the data; streams that write hundreds of files a day pay more.
- The fault outcomes: hold at any size. They follow from what each layout does: a window drops rows older than the window, and adding totals counts a replay twice. The runs confirmed them; they did not discover them.
Limits
- One month of 10,000 public trips, about 300 a day. At this size fixed per-run costs dominate, and the money is cents.
- One shared machine, with a load average of 48 to 152 on 16 threads during the runs, and the five repeats running side by side. CPU seconds vary from run to run (the full rebuild's ratio ran 1.9 to 3.0); pipeline data sizes, file counts and every outcome were identical in all five runs; query scan bytes varied slightly.
- The 5.4 times is close to what counting predicts: over 31 runs the full rebuild opened 496 day files of the landing table and the 3-day window 90, a ratio of 5.5. The runs confirm that arithmetic more than they discover it.
- CPU seconds add up the library's thread pools, and on a loaded machine the same job's CPU varied by about 30% from run to run (largest minus smallest over the median, median across layouts).
- A warehouse bills the time it is provisioned, often with a minimum per start, not the CPU a job used; runs under a second would each cost that minimum in every layout.
- One stack: Delta tables written by the open-source deltalake package, DuckDB on one thread, no cluster. A warehouse engine has other fixed costs and its own ways to skip files.
- Five faults, all from the pipeline recovery part and written before this part existed, but by me, not blind. The fault outcomes follow from each layout's design.
- The prices and query frequencies are declared assumptions, not quotes.
- The layout that adds totals adds every file's totals here; the pipeline recovery part added totals only for days not yet published.
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.
The scorecardPipeline recoveryDesignResultsChecks added after the resultsReproduce it