Data Engineering · 5 min read
Row Counts Matched and Finance Was Still Short
A HackerNoon field guide argues row counts are a smoke test, not a cutover exit criterion. Six of six defect classes, 4,096 checksum buckets, and lag math showing a one-hour backfill costs five hours of staleness.
Key takeaways
- 480 million-row Oracle ORDERS example: 12 million daily changes split 55% inserts, 40% updates, 5% deletes
- A 40-million-row one-hour backfill against 3,000 changes/sec capacity yields ~293 minutes of pipeline degradation
- A 1-million-row random sample of 120 bad rows in 480 million succeeds only 22% of the time; bucketed checksums succeed every time
- 4,096 buckets cap drill-down at 14 million rows, 2.9% of the table
- Redshift does not enforce primary keys, so append-only landing plus latest-per-key apply is required

The row counts matched to the last digit on cutover night, and three days later finance asked why order totals for one region were off by a few thousand dollars. That opening scenario anchors a detailed field guide published on HackerNoon on building change-data-capture (CDC) pipelines into Amazon Redshift with Oracle GoldenGate or AWS DMS. The author's core verdict is blunt: treat row counts as a smoke test, never as the exit criterion for a cutover.
The argument is structural. A matching count proves the pipeline did not lose or duplicate whole rows at one moment in time, but five of six common defect classes leave the count untouched: a lost or out-of-order update, a delete that never reached the target, a truncated large text column, an empty string that became NULL, and timestamps that lost precision or shifted time zone. Six defects are tabulated; only a delete eventually drifts the count, and only sometimes for a double-applied change.
The article leans on one worked example throughout, flagged each time as illustrative rather than from a real system: an Oracle ORDERS table of 480 million rows replicated into Redshift, seeing 12 million changes a day, split into 6.6 million inserts, 4.8 million updates and 0.6 million deletes, or 55, 40 and 5 percent.
How does the tool choice change the failure mode?
The author compares GoldenGate and DMS not on feature lists but on what happens when something goes wrong, explicitly labeling this a rule of thumb rather than a law and directing readers to check licensing and current documentation for their versions. GoldenGate's Extract reads the Oracle redo and writes trail files, which absorb backlog when the target is slow, provided you size the disk. DMS runs a task on a replication instance reading the source logs, so the source logs must stay available until the task catches up. GoldenGate gets the lean for high-volume Oracle estates, strict ordering and long-lived replication. DMS gets it for time-boxed migrations, small teams and AWS-native stacks.
What should land in Redshift?
Every change should land as an append-only record carrying operation, commit position and sequence, then be applied as the latest change per key. One reason is idempotency: applying the same batch twice gives the same result. The other is specific to the target. Redshift does not enforce primary keys; they are informational and used by the planner, so the target stores duplicates silently. The included untested SQL sketch uses ROW_NUMBER over commit_scn and seq, a DELETE-then-INSERT in a transaction, and updates expressed as delete-plus-insert, which suits a columnar store far better than row-by-row updates. Newer clusters also support MERGE, the author notes.
When does the pipeline fall behind?
The lag arithmetic is the sharpest section. Average throughput is about 139 changes per second, roughly 1,100 per second in the busiest hour at an assumed 8x peak, against a sustained apply capacity of 3,000 per second, a comfortable 2.7x headroom. A backfill updating 40 million rows in one hour adds about 11,100 changes per second, pushing total load near 11,250 against the 3,000 capacity, a surplus of 8,250 per second. Using lag approximated as backlog divided by apply rate, a 5-minute target is breached after about 109 seconds when the backlog passes 900,000 changes. By job end the backlog is 29.7 million and lag peaks near 165 minutes; draining at 2,861 per second of headroom takes another 173 minutes. Total: about 293 minutes of degradation from a 60-minute job. A one-hour backfill at the source can cost five hours of staleness downstream.
Two habits fix most of it: alert when lag is rising for ten minutes rather than when it crosses a threshold, and put source-side bulk jobs on a shared calendar. In DMS, watch source and target latency metrics separately, since they point to different bottlenecks.
Why do samples fail where checksums work?
Random sampling feels rigorous and is not. With N as table size, n as sample size and k as corrupted rows, the chance of catching at least one bad row is approximately 1 − (1 − n/N)^k. For 480 million rows with 120 bad ones, a 1-million-row sample succeeds 22 percent of the time; a 10-million-row sample succeeds 92 percent and costs ten times as much. Bucketed checksums over the whole table find the corruption every time. The approach groups keys into 4,096 buckets of about 117,000 rows each, computing portable aggregates (count, sum, max, and a numeric mapping of status values) on both Oracle and Redshift, since hash functions differ between engines. The 120 bad rows touch at most 120 buckets, so drill-down scans at most 14 million rows, 2.9 percent of the table. Two details matter more than the SQL: both sides must use the same commit cut-off, or in-flight changes produce false mismatches the team learns to ignore; and text columns must be canonicalized, especially the empty-string question.
What are the named pitfalls?
The author lists six. Oracle treats an empty string as NULL and Redshift does not. Some LOB (large object) modes cap size and truncate silently. Log retention sized for the average week instead of the worst outage forces a full reload. A schema change on Thursday breaks something on Friday. Timestamp precision, time zones and daylight-saving boundaries rarely fail loudly. And reconciliation without a named owner, a schedule and a paging threshold equals no report at all. The runbook template closes the piece: every cutover step needs an action and a gate, the gate must be a number somebody can check, and the reverse path stays warm for a week, because mismatches surviving three clean reconciliation nights tend to be the slow ones.
Google News: Data Engineering (Source)
More from Marcus Bennett
Show full bio
News editor covering people, launches and day-to-day practice in Analytics Digest is a professional daily at Analytics Digest.
54 articles