Start here
You often need to copy a table from an app database into the warehouse. This chapter uses one interview prompt: get orders from Postgres into the warehouse. The warehouse may be at most five minutes behind.
The big choice is how often to move the data. You can move it in one big run, in small runs, or one event at a time.
What you already know
- A watermark load reads only new rows. A MERGE writes them. Running it twice gives the same result.
- An orchestrator runs a job on a schedule. A daily run at 02:00 loads the day before.
- CDC turns each change into an event with a position. A stream is a feed that sends each event as it happens.
- Kafka is a tool that stores events in order. Flink handles one event at a time.
- Lag is how far the reader is behind the newest change.
What you will learn
- Batch, micro-batch and streaming, and when each order becomes visible.
- How to compare them by latency, cost and effort.
- Event time, windows and watermarks.
- What exactly-once really means.
- How to answer the five-minute prompt.
- What it costs to switch from batch to streaming.
Latency is the time from a change in the source until the warehouse can show it.
We use five new orders on a made-up day, 2026-01-22. All the times here are new.
Orders 110 and 111 have the same customer and amount as in the CDC chapter. Orders 112 to 114 are new too.
Here are the five orders:
| order_id | customer_id | amount | saved at |
|---|---|---|---|
| 110 | 2 | 30.00 | 10:02 |
| 111 | 5 | 9.00 | 10:04 |
| 112 | 3 | 20.00 | 10:06 |
| 113 | 1 | 12.00 | 10:07 |
| 114 | 4 | 7.50 | 10:08 |
