Data Integrity Verification in Replication Pipelines
Data integrity verification proves that the rows in a replication destination are the rows that left the source, complete, unaltered, and not duplicated. As of October 2026 there are four ways to prove it, row counts, column aggregates, chunk hashes, and transport checksums, and each one proves something different at a different cost. Most pipelines run only the first and weakest of the four.
Check | Proves | Misses | Cost on a live table |
|---|---|---|---|
Row count | Both sides hold the same number of rows | Any changed value | One count per side |
Column aggregates | Sums, ranges, and hash XORs match per column | Changes that cancel out | One scan per side |
Chunk hashes | Every byte of every hashed column | Nothing in the hashed columns | One scan plus hashing, then bisection |
Transport checksum | Bytes arrived as sent between two boundaries | What the destination committed | Inline on every batch |
What does a row count actually prove?
A row count proves the destination holds the same number of rows as the source, and nothing else. Datafold's engineers put the limit plainly, a count "Does not detect inconsistencies WITHIN records. E.g. we have same number of rows, but the data in certain fields is stale" (Datafold).
SQL Server replication makes the trade explicit. Its sp_table_validation procedure takes @rowcount_only set to 1 for a count or 2 for a count plus a binary checksum, and even that checksum "skips the contents of text and image columns (by design)" (Microsoft Learn). Run the count first and never run it alone.
How do aggregate parity checks catch value drift?
An aggregate check compares one number per column on each side, such as a sum, a range, or the XOR of a per-row hash. A changed value shows up without hashing the whole table in order. PostgreSQL documents bit_xor for this job, "Can be useful as a checksum for an unordered set of values" (PostgreSQL).
Snowflake's HASH_AGG "produces the same value regardless of the order of the inputs" (Snowflake), so neither side sorts. The pattern below is the Postgres form.
A cross-engine compare needs a hash both sides can reproduce byte for byte, and only some engines offer one.
Engine | Row hash | Order-free aggregate | Reproducible elsewhere |
|---|---|---|---|
|
| Yes, MD5 is published | |
|
| No, result depends on row format | |
|
| No, HASH is proprietary | |
|
| Yes, FarmHash Fingerprint64 | |
|
| sipHash yes, cityHash differs from upstream | |
| Not covered here | Yes, FNV-1a is published |
How do chunked hash comparisons find the differing rows?
A chunk hash check splits a table into primary key ranges, hashes each range on both sides, and bisects any range whose hashes differ until it reaches the rows. Datafold notes that "a single different value in a 1B rows x 300 column table will result in a different hash, same result as if the tables were entirely different" (Datafold).
Percona's pt-table-checksum is the long-running example for MySQL. It "divides each table into chunks of rows, and checksums each chunk with a single REPLACE..SELECT query," and "the target time for each chunk is 0.5 seconds by default" (Percona). The queries "flow through replication to re-execute on replicas," which is why the tool "requires statement-based replication."
The same idea works in plain SQL on any engine with a numeric key, shown here for Postgres.
The ORDER BY inside the aggregate is not optional, since PostgreSQL warns that string_agg results differ "depending on the order of the input values" (PostgreSQL). The open source data-diff tool automated this bisection across engines, but its README now says "Datafold is no longer actively supporting or developing open source data-diff" (Datafold), so the hosted product is the maintained path.
What do transport checksums like CRC32C cover?
A transport checksum proves the bytes that arrived between two code boundaries are the bytes that were sent, and it says nothing about what the destination committed. The Castagnoli polynomial, CRC32C, is the common choice because it is cheap and catches accidental corruption. RFC 3720 states its limit, "These digest options only have error detection significance" (RFC 3720).
Layer | Checksum | Covers |
|---|---|---|
CRC-32C | Every byte from the attributes to the end of the batch | |
CRC-32C | Each record, checked in crash recovery and replication | |
CRC32 | The serialized page, not its header | |
CRC64NVME default, CRC32C optional | The object, validated before it is stored | |
CRC32C recommended | The upload, compared server side |
Database page checksums sit one layer lower. PostgreSQL's data checksums are verified "each time the page is read" (PostgreSQL), which catches corruption on one machine and says nothing about whether the copy on another machine matches. Keep them on, and do not count them as replication verification.
Where verification goes wrong
Four failure modes produce most false alarms and most missed drift, and each has a fix that costs one line of SQL or one setting.
The source keeps moving during the check
A check that reads the two sides at different instants flags rows that are merely in flight. AWS DMS says it directly, "If one or more rows are being continuously modified during validation, then AWS DMS can't validate those rows" (AWS). Oracle GoldenGate Veridata re-checks suspect rows only after the configured replication latency has passed (Oracle). Read both sides at a watermark, or give the check a lag allowance.
Time zones, floats, and NULLs hash differently
MySQL renders TIMESTAMP columns through the session time zone, which Percona warns "can result in every row being deemed out of sync when each server is using in it's own timezone" (Percona). Floats print differently across versions, so pt-table-checksum ships a --float-precision flag. Postgres concat ignores NULLs while Snowflake HASH_AGG(*) includes "records with NULL values" (Snowflake). Cast every column to one text form with an explicit NULL token first.
The hash function is not portable
Snowflake's HASH "is a proprietary function" (Snowflake), and ClickHouse admits its cityHash64 and "Google's upstream CityHash now produce different results" (ClickHouse). CRC32 is portable but "too prone to hash collisions" for whole tables, per Percona (Percona). A cross-engine compare needs MD5, SHA-2, FarmHash, or FNV-1a.
Deletes and stale cursors pass the count
Datafold names the quiet causes, "common sources of inconsistencies are hard deletes" and "stale update timestamps" (Datafold). An incremental sync on an updated_at cursor never sees either one, so the destination drifts while every run reports success. Only a full compare or a change stream catches it.
How the main tools handle verification
Few replication tools verify anything on their own. The ones that check every batch inline are rare, the ones that compare the destination against the source are mostly migration products, and most ELT platforms do neither.
Tool | What it compares | Granularity | Limit |
|---|---|---|---|
CRC32-C over every batch on both sides of the write, plus a checksum of the encoded bytes before transport, on every run | Batch | Does not read committed rows back from the destination | |
Each source row against its target row after full load and during change capture | Row | Needs a primary key, stops after 10,000 failures | |
Chunk checksums replayed through replication | Chunk, then row with pt-table-sync | MySQL only, statement-based binlog | |
Row hashes, then a confirm step after the latency window | Row | Commercial | |
Bulk checksum per table or a row-by-row compare | Table or row | Managed Fivetran instead samples 10,000 rows per connection | |
Vector, record, interval, key, and custom SQL checks | Table or row | Separate product from the streaming platform | |
Chunk hashes with bisection | Row | Open source build unsupported since May 2024 | |
No built-in compare, incremental snapshots re-read tables in 1,024-row chunks | Chunk | At least once delivery on failure | |
Per-state record counts in Socket mode | Count | No documented post-sync compare |
Galaxy builds Filament. Every cell comes from the vendor docs linked in the first column.
The right check for each job
Run a count and a column aggregate after every load, run a chunked hash on a schedule, and treat the row count as a smoke test rather than proof.
What you need to prove | Check | Cost |
|---|---|---|
The load finished | Row count | One count per side |
Values match after a nightly load | Column aggregates | One scan per side |
Which rows differ after a mismatch | Chunk hashes with bisection | Hashing on the ranges that differ |
Bytes survived the network | Transport checksum | Inline, per batch |
A MySQL replica drifted | pt-table-checksum | Half-second chunks, paused when replicas lag |
A heterogeneous migration is complete | Row-level validation such as DMS or Veridata | Continuous, extra load on both databases |
Related guides
Append vs replace vs upsert covers the write modes whose retries create the duplicates these checks catch.
Checkpointing in data pipelines explains the durable progress that keeps a resumed run from writing a batch twice.
Full load vs incremental vs CDC shows why an updated_at cursor misses hard deletes.
Postgres change data capture methods compared covers the change streams that carry the deletes a count cannot see.
Zero-downtime Postgres migration is where a one-time row-level validation pays for itself.
The database replication guide is the pillar this page hangs off.
Frequently asked questions
What is data integrity verification in data replication?
It is the step that proves the rows in the destination are the rows that left the source, complete, unchanged, and not duplicated. Instead of trusting that a run finished without an error, you compare a fingerprint of both sides, such as a row count, a column aggregate, a chunk hash, or a checksum carried with each batch.
How do you verify data integrity after replication?
Count rows on both sides first, then compare one aggregate per column, such as a sum or an XOR of per-row hashes. Run a chunked hash comparison on a schedule to find the exact rows that differ. On a live source, read both sides at one watermark or allow for replication lag before calling a row out of sync.
Is a row count enough to validate a data migration?
No. A matching count proves the destination holds the same number of rows and nothing else. A stale value, a truncated string, a shifted timestamp, or a row deleted and re-inserted all pass a count check. Treat the count as a smoke test and follow it with column aggregates or a hash comparison before signing off.
How do you compare two large tables across different databases?
Split the table into primary key ranges and hash each range on both sides with a function both engines can reproduce, such as MD5 or FarmHash. Bisect only the ranges whose hashes differ. Normalize time zones, floats, and NULLs into one text form first, or every row will look different.
Why do checksums differ between a source and a replica with identical data?
The usual causes are formatting, not data. Timestamps rendered in two server time zones, floats printed at different precision, NULLs that one engine skips and another includes, trailing spaces, and collation order all change a hash while the values are the same. Proprietary hash functions also differ between engines, so use a published algorithm.
Does CRC32C guarantee the data in the destination is correct?
No. A CRC32C on a batch proves the bytes that arrived between two code boundaries match the bytes that were sent, which is why Kafka, Postgres WAL, S3, and Google Cloud Storage use it. It says nothing about whether the destination committed those rows, applied them to the right table, or kept them after a retry.
Which replication tools verify data integrity for you?
AWS DMS compares every row after a full load and during change capture. Oracle GoldenGate Veridata and Fivetran's HVR edition compare row hashes with an allowance for replication lag, Striim sells a separate Validata product, and Percona's pt-table-checksum covers MySQL replicas. Most ELT tools only count rows or sample them, so plan to run your own check.
How often should you run a data integrity check on a replication pipeline?
Run a count and a column aggregate after every load, since each costs one scan. Run a full chunked hash comparison on a schedule that matches the drift you can tolerate, nightly for a reporting replica and weekly for an archive. Run a row-level comparison once before a migration cutover, then retire it.
More articles
Questions
Answered
FAQ
What does Galaxy do?
What is Filament?
What is enterprise context management?
What does working with Galaxy look like?
How do you handle security and compliance?
Why does Galaxy build in the open?
Company
Copyright © 2026 Galaxy. All rights reserved.
