Last updated: December 05, 2026
Quick answer: compare 1 source batch with 1 warehouse batch, then record any gap before anyone uses the data. That is the quickest way to validate record counts between source exports and warehouse imports. If the counts do not match, the job is not done yet, even if the import finished without an error.
Key takeaways
- Count the exported rows first, then compare that number with the warehouse load result for the same file or batch.
- Use the same filter rules on both sides, or the count check can flag a false mismatch.
- Keep a small reconciliation log with file name, load time, expected count, loaded count, and gap.
- A lower warehouse count can reflect rejected rows, a duplicate rule, or a filter, so confirm the cause before calling it data loss.
- The point is proof of load verification, not a perfect file-by-file story.
How do I validate record counts between source exports and warehouse imports?
Validate record counts by checking the source export total, checking the warehouse import total, and comparing the two numbers against the same batch. The cleanest check is a simple row count from the file or export query and a matching COUNT(*) in the warehouse after load.
A basic count check works well because it is easy to repeat and easy to explain. In SQL, COUNT(*) returns the number of rows in a result set, and most warehouses support the same idea in some form. PostgreSQL documents it in its aggregate functions reference, and Microsoft documents COUNT in Transact-SQL: PostgreSQL aggregate functions and Microsoft COUNT (Transact-SQL). Those references matter because the method is plain, not clever: count the rows, then compare the counts.
Use the same scope on both sides. If the source export includes 3 files from the same day, do not compare just 1 file to the warehouse table for all 3. If the export filtered out blank rows, soft-deleted rows, or failed records, the warehouse count must be measured against that same filter set or the mismatch is meaningless.
The result you want is not “the numbers are close.” The result is a clear yes or no for a named batch, such as 2026-12-05 export file A or load_id = 1842. If the count is off by 1, that still needs a reason.
What should I count on each side?
Count the rows that define the same business batch, not just the raw file size. The right count is usually the number of data rows that should exist after any agreed export rules, file splits, and load rules are applied.
Here is a simple comparison table that helps keep the two sides aligned:
| Side | What to count | What to avoid |
|---|---|---|
| Source export | Data rows in the exported file or export query result | Header lines, trailer lines, empty lines |
| Warehouse import | Loaded rows tied to the same batch or load ID | Rows from older loads or later retries |
| Reconciliation check | One source batch against one warehouse batch | Mixing multiple files or dates in one number |

This sounds obvious, but mixed batches cause a lot of false alarms. If one export is split into 4 files, the warehouse count should be the sum of the 4 files, not just the largest one. If the warehouse loads into staging first and then into a final table, the first count can be staged rows and the second can be final rows. Those are different checks.
The best habit is to write down the unit of comparison before the load runs. For example: “Compare file seo_export_01.csv with warehouse load batch_2026_12_05_01.” That note can prevent a lot of back-and-forth later, and if the scope is unclear, it is worth checking with a data owner or DBA before the load is treated as verified.
What is the step-by-step check?
The step-by-step check is: identify the batch, count the source export, count the warehouse import, compare the numbers, then log the result. Keep the process narrow so the same person can repeat it tomorrow without guessing.
- Name the batch or file. Use one file name, one export ID, or one load ID. A count without a batch name is hard to audit later.
- Count the source export rows. Use the export query result or the file contents, and ignore header or footer lines if the export format includes them. The number should reflect the data rows only.
- Count the loaded warehouse rows. Run
COUNT(*)or the warehouse’s equivalent on the target table, filtered to the same batch or load ID. This gives the number that actually landed. - Compare the two numbers. If they match, mark the batch as verified. If they differ, record the gap instead of guessing.
- Write the result in a reconciliation log. Include the file name, load time, source count, warehouse count, and any known reason for the gap. A plain text log or spreadsheet is enough for a first pass.
This process is fast because it does not try to solve every data problem at once. It only answers one question: did the same number of rows leave the source export and land in the warehouse? That is the core of load verification.
The check works best when it is done right after import, before dashboards or reports pick up the data. If the count is wrong, the earlier it is caught, the less cleanup follows.
What causes a mismatch?
A mismatch usually comes from rejected rows, filter differences, duplicate handling, or a partial load. The count itself is only the symptom; the real issue is the path a row took, or failed to take, between source export and warehouse import.

A lower warehouse count can mean the warehouse rejected rows because of type rules, size limits, or bad values. A source count can also be lower if the export query already filtered records out. If the source file has 10,000 rows and the warehouse has 9,998, the missing 2 rows may be in an error file, a reject table, or a retry batch. Without that trace, the mismatch is just a number.
A higher warehouse count is less common, but it happens when the same batch is loaded twice or when a retry runs without clearing the first attempt. It can also happen if the warehouse table contains older rows and the count filter is too broad. A raw COUNT(*) on the full table is not a valid validation check unless the table is dedicated to that one batch.
Do not treat every mismatch as data loss. Some are signaled by design. For example, if the export query excludes rows that do not meet a rule, the warehouse should show fewer rows by the same rule. The mistake is comparing apples to oranges and then trying to explain the gap after the fact; if the cause is unclear, consult a data professional or review the load documentation and warehouse vendor guidance first.
How do I reconcile count mismatches?
Reconcile count mismatches by tracing the gap to a specific bucket: excluded at source, rejected on load, duplicated in load, or counted against the wrong batch. That four-part split keeps the review simple and usually gets you to the answer faster than opening every file by hand.
Start with the load metadata if it exists. A lot of warehouse jobs keep a load ID, reject count, or error table. If the load says 9,998 rows loaded and 2 rows rejected, the mismatch is no longer mysterious. It is a known load result. If there is no metadata, check whether the warehouse table was loaded by append, merge, or replace, because each one changes the meaning of the count.
If the source export is split across several files, compare each file count before comparing the total. One file with a gap can hide inside a larger batch total. If the warehouse uses staging and final tables, compare the source file to staging first, then staging to final. That gives you two shorter checks instead of one vague one.
| Mismatch pattern | Likely cause | Best next check |
|---|---|---|
| Warehouse lower than source | Rejected rows or filtered rows | Load errors, reject table, export filters |
| Warehouse higher than source | Double load or wide count filter | Load history, batch ID filter, rerun history |
| Counts match but reports look wrong | Wrong table or wrong filter | Confirm the exact table and batch scope |
| One file off, batch total close | Split file issue | Reconcile file by file |
This is the point where many teams skip ahead and only fix the number. That is a mistake. If the batch is wrong once, it will be wrong again unless the cause is written down and checked on the next import.
What mistakes make count checks fail?
Count checks fail when the source and warehouse are not measuring the same thing. The most common mistake is counting the full warehouse table while the source count came from one export file. That can make a clean load look broken, or a broken load look fine.

Another common mistake is including header rows, trailer rows, or blank lines in the source count. A CSV with 1 header line and 500 data rows is not a 501-row batch for reconciliation. The warehouse usually loads only the data rows, so the counts will never match if the source side includes extra lines.
A third mistake is relying on a dashboard count instead of a load count. Dashboard queries often apply business filters, joins, or date limits, which changes the row total. That is useful for reporting, but it is not a load verification check.
The last mistake is skipping the log. If the result is not written down, the same mismatch gets re-opened later with no proof of what was checked. A one-line note with the file name, load ID, and two counts is enough. That small record often saves 15 minutes or more the next time someone asks why the numbers differ.
For readers working through the wider topic, How to validate exported SEO data before loading it into dashboards covers the bigger path from export to reporting. This article stays on the narrower job: proving the rows landed intact after import. For a related workflow, see also reconcile source files and warehouse tables and review load errors in staging tables.
Which count should I trust when they differ?
Trust neither count until you know which side is scoped correctly. The right answer is the count tied to the agreed batch definition, not the count that happens to be larger or easier to find.

If the warehouse count is lower, start by checking whether the source export included rows that were meant to be excluded before load. If the source count is lower, check whether the warehouse includes retries, duplicates, or records from a wider batch. A number by itself does not prove the problem; batch scope proves the problem.
The best practice is to keep a single reconciliation rule for each import type when the same team owns the export format and warehouse load design. For example, one rule may say “compare file rows to staging rows,” while another says “compare staging rows to final rows.” That gives each count a job. Without that rule, a COUNT(*) can be technically correct and still useless for validation.
This is also where a hard stop helps. If the row counts do not line up and the cause is not known, do not move the data forward as if the import is clean. The point of validation is to catch the mismatch before it turns into a reporting error.
What if the warehouse count is lower than the source file?
A lower warehouse count can mean some rows did not load, but it does not always mean data is missing. The rows may have been rejected, filtered, or moved into another table during the load. Check the reject path, the batch filter, and the load log before treating it as loss.
If the difference is small, resist the urge to guess. A gap of 1, 2, or 10 rows can come from the same simple cause, such as a bad value in one field or a duplicate rule. The fix is to trace those rows, not to adjust the count on paper.
How do i reconcile count mismatches?
Because the warehouse count already points to a scoped batch problem, reconcile count mismatches by comparing like with like and then tracing the gap through the load path. Start with the batch ID, file name, or load ID, then check source rows, load rows, and any reject records tied to that same batch.
If the mismatch remains, split the batch into smaller pieces and compare them one by one. A file-level check is often faster than one giant total. Keep the result in a log so the next import can be compared against the same rule set.
Drafted with AI; not yet reviewed by a person.