By Rohit Ray · Independent educational lesson · Explore this visual lab

Module 13 · Lesson 9 of 11Detailed study · about 22 min

Late-arriving data and safe backfill

A late event belongs at its business effective time, not at the time it arrived. Rebuilding an affected timeline can split an existing interval.

Understand the idea

E4 arrives now but says C1 moved to Nashik on February 1. It must split Pune’s interval at February 1 while leaving Mumbai effective March 1. Updating only the current row would incorrectly change the present city to Nashik.

Key ideas in simple English
ConceptWhat it means
Arrival positionNew delivery ID 5.
Effective timeAn older February business change.
BackfillControlled insertion of previously missing history.
RestatementReconcile facts whose historical version assignment changes.

A concrete example

E4 arrives now but says C1 moved to Nashik on February 1. It must split Pune’s interval at February 1 while leaving Mumbai effective March 1. Updating only the current row would incorrectly change the present city to Nashik.

Remember: Place it in effective-time order and reconcile affected fact mappings, rather than treating arrival order as business order.

Explain it step by step · full theory

Understand the concept

E4 arrives now but says C1 moved to Nashik on February 1. It must split Pune’s interval at February 1 while leaving Mumbai effective March 1. Updating only the current row would incorrectly change the present city to Nashik.

We append the event with a new delivery position rather than changing an old accepted delivery. Preserve the full ledger and rebuild the affected customer inside the transaction. Existing version surrogate keys stay stable because they come from the ledger.

Apply it in practice

Add an exact replay of E2 at position 6. This should advance the ingestion cursor without creating another Mumbai version. Repeating the procedure again with no new input should add no successful-run audit.

A late boundary can mean February sales were previously linked to Pune’s surrogate key and should now link to Nashik. Preserving keys does not automatically fix that mapping. Re-resolve affected facts by effective time and reconcile totals before declaring a production backfill complete.

Words used in this lesson
Arrival position
New delivery ID 5.
Effective time
An older February business change.
Backfill
Controlled insertion of previously missing history.
Restatement
Reconcile facts whose historical version assignment changes.

See how it works

Choose a step to explore the idea at your own pace.

Open the interactive explanation
Interactive explainer1 / 2

Late-arriving data and safe backfill

Arrival position
Effective time
Restatement

Understand the flow

A late event belongs at its business effective time, not at the time it arrived. Rebuilding an affected timeline can split an existing interval.

Automatic playback is off for reduced motion. Select any step or use Previous and Next. Illustrations explain behavior; they are not live measurements.

Read the complete diagram explanation
  1. Understand the flow

    A late event belongs at its business effective time, not at the time it arrived. Rebuilding an affected timeline can split an existing interval.

  2. Apply the contract

    Place it in effective-time order and reconcile affected fact mappings, rather than treating arrival order as business order.

Try the SQL or command

Read → predict → run in your learning environment → compare. You can also learn by reading without an account.

New to SQL? Where to run it and how to read it

A query is a question written in SQL. Snowflake runs it and returns a result table. This website shows examples; it does not connect to your account.

  1. No account yet? Read and predict the output first. Follow the account and Snowsight lesson when you are ready.
  2. For SQL practice, use a learning account in Snowsight and select an authorized role and warehouse. A role determines permissions; a warehouse supplies processing power. Follow the example’s database/schema setup when it refers to stored objects.
  3. Read the entire example, including comments beginning with --. Run the selected statement or labeled block in the stated order. Examples labeled Python, shell or HTTP belong in that client, not in a SQL editor.
  4. Compare values and row counts with the explained result. If an example deliberately causes an error, follow its rollback and cleanup steps before continuing.
SELECT / FROM
Choose the values to return / identify their input.
VALUES / COLUMN1
VALUES supplies tiny example rows. COLUMN1 means their first column, COLUMN2 their second.
AS / WITH
AS gives a result a readable name. WITH names a temporary query step within one statement.
NULL / ::
NULL means missing or unknown. The :: notation converts a value to a named data type.
Session
One connection and its settings. Keep related transaction steps in the same session.
Database.schema.table
A full address for stored data. It is separate from the warehouse that processes queries.

Need the L2_OBJECTS_LAB setup? Open the first database-object lesson →

Help with common practice errors
  • No active warehouse: select a warehouse your role can use. Do not assume you need to create a new one.
  • Object missing or not authorized: check the full name, required setup and active role. Ask the account owner for access if needed.
  • Object already exists: setup may already have run. Read the current state or choose a fresh lab name consistently; do not add OR REPLACE blindly.
  • Different result: check whether an earlier INSERT or UPDATE changed the data. VALUES examples provide their own fresh input for each statement.

Before running this lesson

Manual learning exercise. Production deployment needs source-specific contracts, access controls, orchestration and operational monitoring.

Late-arriving data and safe backfill — SQL example

Definition: A late event belongs at its business effective time, not at the time it arrived. Rebuilding an affected timeline can split an existing interval.

When to use: Follow the isolated customer-history lab in lesson order.

Example: C1: Pune Jan–Feb, Nashik Feb–Mar, Mumbai Mar–open; C2 remains Delhi. Four dimension rows, watermark 6. Audit rows: (4,4) and (6,2); empty replay adds no row.

SQL · example
INSERT INTO INPUT_EVENTS VALUES
 (5,'E4','C1','Nashik','2026-02-01'),
 (6,'E2','C1','Mumbai','2026-03-01');
CALL APPLY_CUSTOMER_BATCH(FALSE);
CALL APPLY_CUSTOMER_BATCH(FALSE);
SELECT CUSTOMER_ID,CITY,VALID_FROM,VALID_TO FROM DIM_CUSTOMER ORDER BY CUSTOMER_ID,VALID_FROM;
SELECT * FROM PIPELINE_STATE;
SELECT BATCH_END,DELIVERIES FROM RUN_AUDIT ORDER BY BATCH_END;

What to expect and why

C1: Pune Jan–Feb, Nashik Feb–Mar, Mumbai Mar–open; C2 remains Delhi. Four dimension rows, watermark 6. Audit rows: (4,4) and (6,2); empty replay adds no row.

Check your understanding

Choose an answer, then check your reasoning. This is practice, not a scored test.

Should an older effective change overwrite the newest current city?

Try it yourself

Explain with the example: Should an older effective change overwrite the newest current city?

Compare your reasoning

Place it in effective-time order and reconcile affected fact mappings, rather than treating arrival order as business order.

Official sources and curriculum

Module 13 · See module scope