Data Quality
Advanced 16 min read Data Quality

Reconciliation and Record Matching

Proving two copies of the truth actually agree

Reconciliation verifies data matches its source or between systems — counts, totals and record-level equality — turning 'data seems fine' into provably matched data.

reconciliationrecord matchtotalscountcross-systemsurvivorship
Before we start

What you will learn

  • Build count, sum and key-based record-level reconciliation between two systems
  • Classify mismatches (missing, extra, changed) and route them
  • Design idempotent match keys so joins never depend on formatting
Introduction

What is this?

Reconciliation answers one question: does the data I have match what it should be? At the simplest level you compare counts and key totals between source and landing. Deeper reconciliation matches records by key and flags additions, deletions and changed values. It is the standard control for financial loads, warehouse-to-lake copies and after integrations — an independent check that the pipeline moved everything, exactly.

Motivation

Why do you need it?

  • Row counts and totals in a warehouse can be quietly wrong (dropped batches, filtered rows, duplicate extras).
  • Regulators and finance teams require an independent 'tie-out' between systems.
  • Reconciliation is the fast path to root cause: a missing-count discrepancy names the exact losing step.
  • It guards migrations — before cutting over res themselves, you prove the new system matches the old byte-for-byte.
Think about it

Mental model

Imagine

A banker matching a ledger to the bank statement

Think of

Database reconciliation

You don't trust the ledger if the totals don't tie to the statement. Reconciliation checks counts, sums and line items the way a bookkeeper matches each transaction row to its document.

Mechanics

How it works

  • Count reconciliation: compare row counts source vs target (with filters aligned).
  • Total reconciliation: compare SUM of key monetary/volume columns, possibly per dimension bucket.
  • Record-level match: build a natural key on both sides, then do a full outer join to classify exists/extra/missing/different.
  • Difference analysis: for matched keys with differing values, compute per-field diffs.
  • Publish a reconciliation report: totals, matched, missing, extra, changed, plus a pass/fail verdict.
  • Escalate or auto-repair: halts before publishing, or spill lists for manual tie-out.

Source vs target reconciliation outcome classes.

Source
Target
Match
Outcomes
Report
Real world

In production

  • A payment processor runs an hourly count+sum reconciliation between its Postgres source and Redshift landing; any mismatch blocks the downstream risk batch.
  • Before a 2TB warehouse migration, a team reconciles row counts, checksums and sample keys between old and new — zero-difference is the go-live gate.
  • A bank does daily record-level matching of customer-account feeds and publishes a signed tie-out report for auditors.
Guidelines

Best practices

  • Make match keys normalization-stable: trim, case-fold, coerce types, and document the key.
  • Reconcile at the grain you verify (per partition, per day) so a mismatch names the failing slice.
  • Compare checksums/hashes for whole-row equality on large tables instead of per-field diffs.
  • Reconcile the earliest landing before transforms, or you can't distinguish copy-loss from transform bugs.
Watch out

Common mistakes

  • Matching by PK the target auto-generates — that key doesn't exist in the source.
  • Comparing raw text with formatting differences (currency, timezone) and paging false mismatches.
  • Only checking counts — duplicated+missing pairs both pass a count check.
  • Ignoring the reconciliation result because it 'usually misses a few' — drift pollution of your own signal.
When things break

Debugging tips

  • Diagnose by mismatch class: 'missing' points to extraction/retention, 'extra' to duplicated inserts, 'changed' to a transform rule.
  • Pull 10 sample keys from each class and eyeball them — a pattern appears fast.
  • Run reconciliation twice: once raw, once on cleansed keys; the diff between the two reports shows the normalization cost.
  • When totals disagree but counts match, suspect rounding, currency or NULL handling in the SUM.
Interviews

Interview checkpoint

Practice

Hands-on lab

Reconcile Two Copies of a Ledger
30 min · advanced
In progress
Objectives
  • Compare row counts and totals between source and target
  • Classify each record as matched, missing, extra or changed with an outer-join on the natural key
  • Produce a pass/fail report with the classified mismatch counts

Reconcile Two Copies of a Ledger

30 min · advanced

0/3 steps
0%
sandbox · Linux sandbox
$
Try these commands
Test yourself

Quick quiz

0/2
1

A reconciliation shows the same row count but different totals. Likely cause:

2

Record-level matching must use a key that also exists at the source.

Go deeper

Official documentation