Why does yesterday's revenue in your dbt model come out 1.8% lower than the same number queried straight from the source, and why does the gap disappear after a --full-refresh? If that sounds familiar, the model is not broken in any obvious way. It runs green, tests pass, and the missing rows are exactly the ones that arrived late.
Nearly every incremental model starts from the same pattern in its is_incremental() block: select rows newer than the newest row already in the target. That filter is correct only if rows arrive in timestamp order. Mobile apps that buffer events offline, CDC pipelines with long transactions, and vendors who resend corrected files all break that assumption, and the filter drops what they send with no error at all.
Why the max-timestamp filter silently skips rows
The canonical incremental model looks like this. In the snippets below, THIS stands for the Jinja this relation and STG_EVENTS for the ref to the staging model; in a real model file each is a Jinja expression inside double curly braces, and the model config lives in YAML.
select *
from STG_EVENTS
{% if is_incremental() %}
where event_ts > (select max(event_ts) from THIS)
{% endif %}
On the first run, is_incremental() returns false, the filter is skipped and the whole history is built. On every later run the subquery finds the newest event_ts already in the target, say 23:59:40 yesterday, and only rows newer than that come through.
Now picture a row with event_ts of 21:15 yesterday that lands in the source at 03:10 today, because the phone that produced it was offline. At 03:30 the dbt job runs. Its filter asks for rows after 23:59:40. The late row has an earlier timestamp, so it never qualifies, not tonight and not on any future run. Only a full refresh rebuilds history and picks it up.
Three features make this failure hard to spot. The model never errors. Tests such as unique and not_null only see rows that exist, so they pass. And the loss is small per run, often under 1 to 2%, which hides inside normal day-to-day variance until someone reconciles against the source or finance.
A ten-minute diagnosis confirms it. Group the source by event date and count rows, do the same on the model, and join the two on date for the last 14 days. If the model is short by a small, steady share on older dates and close to complete on the newest date, rows are arriving late and the filter is dropping them.
If the gap is concentrated on the most recent day only, it is more likely a loader delay that the next run will fill. The shape of the gap tells you which problem you have before you touch any code.
Three timestamps, and only one belongs in the watermark
Most event data carries at least three timestamps, and the choice between them decides whether late rows survive.
The event time is when the thing happened: the click, the payment, the sensor reading. It is what dashboards group by. It is also the worst choice for an incremental filter, because late arrival means precisely that event time and arrival order disagree.
The loaded-at time is when the row landed in your warehouse, set by the loader (Fivetran's _fivetran_synced, Airbyte's _airbyte_extracted_at, or a column your own pipeline adds). It moves forward with arrival, so a filter on it picks up a late row on the next run regardless of its event time. For append-only sources this is usually the right watermark.
The updated-at time is when the source system last changed the row. It is the natural watermark for mutable tables such as orders or subscriptions, but it has its own trap. In a CDC pipeline, a long-running transaction can commit a row whose updated_at is several minutes older than rows from shorter transactions already loaded. A strict > filter then skips it.
So the first fix is often a one-line change: filter on loaded-at, not event time. It has two limits. Some sources do not expose a reliable loaded-at column, for example a vendor file that overwrites a table in place. And on columnar warehouses, a filter on loaded-at may not prune partitions that are organised by event date, so each run scans more data than you expect. Both limits push you toward the lookback pattern in the next sections.
There is a subtle point about clock domains too. Loaded-at comes from the warehouse or loader clock, event time from a device or application clock. Mixing them in one comparison, for example filtering source loaded-at against target max event time, produces gaps or duplicates that depend on time zones and clock drift. Compare like with like.
Worked example: an offline mobile event and a 3-day lookback
Here is an illustrative event stream to make the trade-off concrete.
A product analytics table receives about 40 million events a day. An audit of one month shows how late rows arrive, measured as the gap between event time and loaded-at time:
| Arrival delay | Share of events | Events per day |
|---|---|---|
| Under 1 hour | 96.5% | 38.6 million |
| 1 to 24 hours | 2.9% | 1.16 million |
| 1 to 3 days | 0.5% | 200,000 |
| Over 3 days | 0.1% | 40,000 |
With the strict max-event-time filter and an hourly run, almost everything delayed by more than a few minutes is lost, so roughly 3.5% of events never reach the model: about 1.4 million rows a day, or 42 million a month.
Switch to a lookback filter: take rows whose event time falls within 3 days before the target's maximum, and merge them on a unique key so that rows already present are updated, not duplicated. Now everything up to 3 days late gets in. Loss falls to the 0.1% tail, about 40,000 rows a day.
The price is scan volume. An hourly run that used to read about 1.7 million new rows now reads 3 days of history plus the new hour, about 120 million rows, which is roughly 70 times more. On a warehouse billed by bytes scanned that is a real number. If each run scans 12 GB instead of 0.17 GB and you run 24 times a day, the model reads close to 290 GB daily instead of about 4 GB.
Two cheaper variants exist. Run the lookback only once a day, in a nightly job, and keep the hourly job on a short 2-hour window. Or narrow the lookback to 1 day, accept 0.6% loss, and schedule a weekly full refresh to sweep the rest. Which one wins depends on whether 0.6% matters to the people who read the numbers; for an engagement dashboard it might not, for revenue reconciliation it will.
Fixing it step by step: lookback, unique key and the right strategy
The lookback pattern only works when three settings agree with each other. Here is the order to change them.
- Measure the delay first. Query the source for the distribution of
loaded_at - event_tsover the last 30 days, and pick a lookback that covers the percentile you care about, for example the 99.9th. - Add a
unique_keyin the model's YAML config, using a real natural key such asevent_id. Without it, reprocessing a window inserts the same rows twice. - Choose an
incremental_strategythat respects the key. On Snowflake and BigQuery,mergeis the default and works.delete+insertis a good choice where merge is slow or unavailable. Plainappendignores the key and will duplicate rows on every lookback. - Rewrite the filter as a window. In the incremental branch, use
where event_ts >= (select max(event_ts) from THIS) - interval '3 days', with date arithmetic adjusted for your warehouse's SQL dialect. - Restrict the merge scan. On large targets, add
incremental_predicatesso the merge only compares against recent partitions of the target, such as the last 4 days. Otherwise each merge can scan the whole target table. - On BigQuery, consider
insert_overwritewith a partitioned table. dbt replaces the event-date partitions touched by the new data, so a 3-day lookback rewrites 3 or 4 partitions instead of merging row by row, which is often cheaper. - Run one
--full-refreshafter deploying the change, so history lost before the fix comes back, and record the row count before and after.
A fair objection comes from teams with strict cost budgets: why not keep the strict filter and accept the loss, since 3.5% of engagement events rarely changes a product decision? For exploratory dashboards that argument holds, and a cheap model that is consistently 3% short can be more useful than an expensive one that is exact.
It stops holding the moment anyone sums the model into money, compares it with a source system, or trains a model on it, because the missing rows are not random. Late events come disproportionately from offline mobile sessions, weak networks and certain regions, so the bias lands on specific segments, which is worse than an even undercount.
Step 5 is the one people skip, and it is why some teams try a lookback, see costs triple, and revert to the broken version. The merge has two sides: the new rows you select, and the target rows it matches against. A lookback limits the first. Without predicates, the second is the entire table.
Microbatch in dbt 1.9 and later: the built-in lookback
Since dbt Core 1.9, released in December 2024, there is a strategy designed for exactly this problem. Microbatch splits an incremental model into time-bounded batches and lets dbt handle the window logic instead of a hand-written filter.
The configuration replaces the is_incremental() block entirely. You set incremental_strategy: microbatch, an event_time column, a batch_size of hour, day, month or year, a begin date for the first build, and a lookback count. With daily batches and lookback: 3, every run reprocesses the current day plus the 3 before it. Upstream models that also declare event_time are filtered automatically to each batch's time range.
Three properties make it attractive for late data. On most adapters each batch is replaced as a unit, so reprocessing does not rely on a unique key to avoid duplicates (Postgres is an exception that merges on one). Failed batches can be retried on their own with dbt retry. And backfills become explicit: dbt run --event-time-start "2026-10-01" --event-time-end "2026-10-08" rebuilds one week without touching the rest.
There are limits. The batch boundaries follow event time, so a row that arrives later than the lookback is still lost, exactly as with a manual window. Batch replacement relies on adapter support, and behaviour differs across warehouses, so test it on yours. And a model with 1,000 daily batches can be slow on a first build if they run one after another; whether they run in parallel depends on the adapter and the concurrent_batches setting.
For a new model on a supported adapter, microbatch is the cleaner design. For an existing model with a working merge and a lookback, migrating is only worth it if retries and backfills are a regular pain.
A checklist to run before you trust the incremental table again
After any change to incremental logic, run these checks. Each one has caught a real class of bug in late data fixes.
- Daily row counts match the source for the last 30 days, within a tolerance you write down, for example 0.05%.
- No duplicate values of the unique key: a
uniquetest onevent_idpasses on the full table, not only on new rows. - The lookback covers your measured delay percentile, and the number lives in a variable or YAML, not hard-coded in three places.
- Time zones match: the watermark comparison uses one clock domain, with both sides in UTC.
- The merge target is limited by
incremental_predicatesor partition replacement, and you have checked bytes scanned per run. - Upstream sources have freshness checks, so a loader outage shows up as a failing
dbt source freshnessrather than as a quiet gap. - A scheduled reconciliation job compares a daily total, such as revenue or event count, against the source and alerts when the gap exceeds the tolerance.
The last item is the one that would have caught the original problem. Most teams only add it after finance finds the gap first.
What analytics engineers ask about late data in dbt
Does dbt test catch rows missing from an incremental model? Not by default. Generic tests such as unique and not_null check rows that exist. To catch missing ones, compare daily counts against the source with a custom test or a package like dbt-utils, whose equal_rowcount and recency tests help here.
How often should I run a full refresh on a large incremental model? Many teams schedule one weekly or monthly as a safety net, during a low-traffic window. On a 2 TB BigQuery table, on-demand pricing of 6.25 dollars per TiB puts the scan alone near 11 dollars per run, so price it before putting it on a cron.
Can snapshots solve late-arriving data instead? Snapshots track changes to mutable rows over time (slowly changing dimensions, type 2). They detect updates to existing keys, but they do not change how an incremental fact model filters new rows, so they are a different tool.
Is late data a problem for append-only event tables only? No. CDC streams from OLTP databases hit it too: a long transaction can commit a row whose updated_at is minutes older than rows already loaded, so an updated_at watermark skips it.
Do not reach for a lookback window on every model. If the table has under a few million rows, materialise it as a plain table and rebuild it each run: simpler, and late data cannot hide.
Do not widen a lookback to cover a 30-day tail when only one downstream report needs that precision; give that report its own reconciled model. And if the source rewrites history in place without any loaded-at signal, no incremental filter will be trustworthy, so schedule full refreshes and save the cleverness for sources that behave.