Skip to content
Data workflows3 min read

By · Editorial policy

Find Missing Records in a Data Sync

Compare source and destination record identities within the same account, time window, and filters. Report missing, duplicate, or stale records separately. Equal counts alone cannot distinguish a missing record from a duplicate that cancels it out numerically.

What is the practical answer?

Compare source and destination record identities within the same account, time window, and filters. Report missing, duplicate, or stale records separately. Equal counts alone cannot distinguish a missing record from a duplicate that cancels it out numerically. Imagine the expected IDs are A, B, and C. The destination contains A, A, and C. Both counts are three, but B never arrived and A appears twice. Start with a pinned input snapshot or a documented watermark, then capture comparable destination rows for the same scope. Keep account IDs in the comparison if record identifiers are only unique within a tenant. Normalize identifiers according to the source contract. Preserve case when it is significant and trim only where both systems treat whitespace identically. Record mappings from source IDs to provider IDs if the destination generates its own.

Evidence: PostgreSQL SELECT, grouping, and set operations · Reddit workflow acceptance testing discussion

  1. Pin source and destination scopeInput
  2. Compare record identitiesProcess
  3. Classify discrepanciesDecision
  4. Repair and reconcile againRecovery
Reconciling identities shows which records are missing even when the overall counts match.

Build comparable inputs#

Normalize identifiers according to the source contract. Preserve case when it is significant and trim only where both systems treat whitespace identically. Record mappings from source IDs to provider IDs if the destination generates its own. Group by source identity to find duplicates, then compare versions or digests for records present in both sets.

What you findWhat to do
Expected ID absent at destinationidentify and repair the specific source record.
Destination ID appears twiceinvestigate the write key before removing business data.
Same ID, different versioncompare update ordering and observed payload digests.

Repair the differences you can explain#

Produce a small discrepancy manifest containing the source ID, expected version, observed version, and reason. Backfill missing records through the usual validated write path. Leave unmatched destination rows for review when they could represent legitimate data outside the sync’s ownership. Reconcile again after repair to verify the expected set.

Write an operator-friendly discrepancy report#

A report can include source system, account, source key, source version, matching destination keys, and discrepancy code. Separate duplicate source keys from duplicate destination rows because they have different owners. Where the target is eventually consistent, rerun the comparison after a bounded visibility delay before creating a repair batch.

For a large transfer, compare partitions using the same scope where possible and drill down to individual IDs in mismatched partitions. A checksum can identify a partition that needs inspection, but the repair should still name records and versions. Log the post-repair comparison using the same input scope so a second operator can tell if the discrepancy was corrected or excluded.

Verify it with a failure drill#

Seed the sets A/B/C and A/A/C and compare scoped IDs and multiplicities.

  • Expect missing B and duplicate A despite equal counts. After repair, compare again and verify exactly one current record per expected ID.

Sources and further reading

Official references support technical claims; community discussions are used only as problem signals.