internalsGet Pro

Module 01 · Lesson 5 of 11Free

Operational vs analytical data: two different jobs

Level
Beginner
Topic
Data engineering fundamentals
Reading time
13 min

When you finish this page you can

  1. Tell operational data from analytical data by the question each one answers.
  2. Explain why an analytical copy keeps history and frozen values that the store’s tables overwrite.
  3. Choose how a nightly load keeps history, using a storage estimate.
  4. Spot the failures that come from serving one job with the other job’s data.

Builds on 2 lessons

Start with lesson 112 min
  1. Introduction to data engineering12 min
  2. Data sources: databases, events, files and APIs13 min
0:00 / 4:45
Show transcript

0:00 Meet Daniel. He leads finance reporting at Kartly, an online store in India. On the first of November, he sent leadership October’s revenue for Pune. It was 4.10 crore rupees. On the fifteenth, he ran the same query again. Now it said 3.98. October was over. Nobody edited the query. Nothing failed. So how can the past change? The store’s tables only know the present. A table that shows today is not a record of October. This video asks one question. Why should the data for reports not be a plain copy of the store’s tables? And what should it keep instead?

0:32 Kartly’s data does two different jobs. The first is running the store. That is operational data. It is the data an app runs on: the current state of each order, cart and customer. The second is answering questions. That is analytical data. It is a copy, built to answer questions about many records over time. Compare the questions each one answers. The order page asks for one order, and shows its status. Finding one row like that is called a point lookup. Daniel’s report asks something else. It reads every October order and adds them up. That is about 1.9 million orders, to return a few dozen rows. One row, or millions. And one more difference. Operational data holds now. Analytical data holds then: what was true at each point in time.

1:11 When an order ships, the app updates its row. The old value is gone. When a customer moves from Pune to Mumbai, the app changes one city. That is the right design for the store. Checkout must ship to where the customer lives now. Not where they lived in October. Now look at Daniel’s October. Some orders were cancelled after the first of November. His report drops cancelled orders, so they left the total. Other customers moved out of Pune. The report looks up each customer’s city as it is today, so their October orders now count somewhere else. The first change is real news. The second is wrong, because Pune earned that money in October. And the store cannot tell Daniel which change moved the number.

1:47 So Meera, Kartly’s data engineer, does not build the copy as a mirror of the store’s tables. It differs in a few ways. First, it keeps history. Each night’s load adds rows instead of overwriting them. Every row is stamped with when it was seen. Now Daniel can rerun October as of the first of November, and get 4.10 crore again. Second, it freezes values at the time of the event. When an order is first loaded, Meera copies the customer’s city onto it. That is called a historical snapshot. A later move does not change it. Third, it joins ahead of time. The store spreads an order over three tables. The copy puts everything a report needs on one wide row. That repeats data. But nobody edits these rows by hand, so it is safe here.

2:26 History has a cost. It keeps growing. So how much should the nightly load keep? There are three ways to load. One: replace a mirror of the orders table each night. That takes about 4 gigabytes. It is simple, but the past can change without a trace. Two: save a full snapshot every night. A snapshot is a complete copy of the table at one moment. That grows to about 1.5 terabytes a year, mostly rows that did not change. The third way saves only the rows that changed since the last load, stamped with the load date. That is about 13 gigabytes a year, for the same nightly history. Daniel needs to rerun past reports and explain every difference, so the mirror is out. Changed rows win. They need the store to record an updated time on every change. And history is only as fine as the load. An order placed in the morning and cancelled in the afternoon is seen once, as cancelled. To catch that, read the database’s own change log. That is called change data capture.

3:15 The opposite mix fails too, and more quietly. The product team wants an Only three left badge on product pages. Stock counts are already in the analytical copy, so they read them from there. At one in the morning, the nightly load records three phones left. By eleven, the phones have sold out in the store. But the badge still says Only three left. Customers keep paying for a phone Kartly does not have. Each order is cancelled and refunded the next day. The fix follows the two jobs. Anything a customer acts on now, like stock, price or order status, comes from the store’s database. That is the source of truth. When the app needs an analytical result, like bestsellers this week, the pipeline works it out. Then it copies the small result back into an app database. Daniel’s reports read the analytical copy instead, so October gives the same answer on every rerun. Even when one company runs both, current state and history are different tables with different jobs.

4:05 Here is the recap. One. Operational data runs the app, one row at a time, and must be current. Analytical data answers questions over millions of rows, and must be complete. Two. The store overwrites the past, so a plain copy of its tables cannot repeat October. Three. The analytical copy keeps history, freezes values at the time of the event, and joins ahead of time. Four. Mirroring loses history. Full snapshots are huge. Appending changed rows keeps it for far less. Five. Customers act on the store’s data. Reports read the copy. Meera’s copy is up to a day old. That suits Daniel’s seven o’clock report. A festival sale dashboard needs something much fresher. The next lesson is batch versus streaming.

October’s revenue changed in November

On 1 November, Daniel sent leadership October’s revenue for Pune: ₹4.10 crore. On 15 November he ran the same query again, to check a slide. It said ₹3.98 crore.

October was over. Nobody edited the query. Nothing failed.

is an online store in India. It takes about 60,000 orders a day, and its app writes every order and click into a PostgreSQL database. Daniel leads finance reporting, and his query read that database’s read replica directly.

This lesson answers one question: why can’t the data for reports be a plain copy of the store’s tables, and what should it keep instead?

Check yourselfAnswer in your head first, then reveal
Daniel’s query joined October’s orders to the customers table to get each order’s city, and left out cancelled orders. Name two things that could have changed between 1 and 15 November.Show answerHide answer
Some October orders were cancelled or returned after 1 November, so their status changed. And some customers moved to another city, so their October orders now count under the new city. The store’s tables hold only the present, so the past moved with them.
The store keeps one row per order and overwrites it. The analytical copy keeps one row per order per change, stamped with when it was seen.

The Pune totals, and the reasons behind them below, are this lesson’s scenario numbers.

Two jobs, two kinds of question

OLTP vs OLAP showed that the two workloads do different amounts of work. reads or writes a few rows, fast. reads a large part of the data and adds it up. This lesson looks at what that means for the data itself.

is the data an app runs on: the current state of each order, cart and customer. is a copy built to answer questions about many records over time.

Here are the two questions Kartly asks most, side by side.

SQL
-- Store database: the order page asks for one order.
SELECT order_id, status, amount_inr
FROM orders
WHERE order_id = 48213907;
SQL
-- Analytical copy: Daniel's report reads every October order.
SELECT city_at_order, count(*) AS orders, sum(amount_inr) AS revenue_inr
FROM analytics_orders
WHERE ordered_on >= DATE '2026-10-01' AND ordered_on < DATE '2026-11-01'
  AND status <> 'cancelled'
GROUP BY city_at_order
ORDER BY revenue_inr DESC;

The first is a : one row, found through the primary key. The second reads about 1.9 million orders (60,000 a day × 31 days) to return a few dozen rows.

Operational data Analytical data
Who reads it The app, for each customer Daniel, analysts, dashboards
Rows per question One or a few Millions
What it holds Now: the current state Then: what was true at each point in time
How it changes Many small updates, all day Bulk loads, once a night at Kartly
Must be Up to the second, and correct for each change Complete, consistent and reproducible

Most of this table you could have guessed. The row that causes Daniel’s problem is the third.

The store’s tables keep only the present

When order 1001 ships, the app runs UPDATE orders SET status = 'shipped'. The old value is gone. When a customer moves from Pune to Mumbai, the app updates one city column in customers.

That is the right design for the store. keeps each fact in one place, so a customer’s city is stored once and every screen shows the new address. Checkout must ship to where the customer lives now, not where they lived in October.

Daniel’s question is about October, though. Here is how 1,000 October orders in Pune moved between his two runs:

Orders cancelled or returned after 1 November

600 orders × ₹1,200 = ₹7.2 lakh

Their status changed to cancelled, so the filter now drops them.

Customers who moved out of Pune in November

400 orders × ₹1,200 = ₹4.8 lakh

The join now gives their new city, so their October orders count elsewhere.

The gap

₹4.10 crore − (₹7.2 lakh + ₹4.8 lakh) = ₹3.98 crore

Every number moved for a reason, but the replica can’t tell Daniel which one.

Order counts and the ₹1,200 average order are this lesson’s scenario numbers; the average comes from Introduction to data engineering.

The first change is real news: finance may want late cancellations counted. The second is wrong: Pune earned that money in October. Both are invisible, because the past was overwritten.

The analytical copy is shaped for questions

So Meera, Kartly’s data engineer, doesn’t build the analytical copy as a mirror of the store’s tables. It differs in four ways.

  1. It keeps history. Each load adds rows instead of overwriting them, stamped with when they were seen. Daniel can rerun “October as of 1 November” and get ₹4.10 crore again.
  2. It freezes values at the time of the event. When an order is first loaded, Meera copies the customer’s city onto it as city_at_order. That is a : a later move doesn’t change it.
  3. It joins ahead of time. The store splits an order across orders, customers and products. The analytical table puts the columns reports need on one wide row. That repeats data, which is , and it is safe here because nobody edits these rows by hand. Normalized vs denormalized tables covers when it pays.
  4. It is stored for scans. Analytical engines such as are designed for OLAP 1 and usually use , so a report reads only the columns it names. Row and columnar storage shows why.
The store spreads an order across three tables and keeps only today’s values. The analytical row joins them once, and keeps the city as it was when the order was placed.

Freezing the city works for one column. Keeping every change to every customer is a modeling technique of its own, covered in Slowly changing dimensions.

History has a cost, though: it keeps growing. How much should the nightly load keep?

How much history to keep

For this estimate, Kartly has about 20 million orders so far (about a year at 60,000 a day), each about 200 bytes. About 120,000 older orders change status each day as they ship and are delivered.

A mirror of the orders table

20,000,000 orders × 200 bytes ≈ 4 GB

Replaced every night, so storage stays at about 4 GB, and grows only as orders grow.

A full snapshot every night

4 GB × 365 nights ≈ 1.5 TB a year

Almost every row is copied again unchanged, and each night’s copy is bigger than the last.

Only the rows that changed

(60,000 new + 120,000 changed) × 200 bytes ≈ 36 MB a night; × 365 ≈ 13 GB a year

About one hundredth of the full snapshots, with the same nightly history.

How should Meera’s nightly load keep the history of Kartly’s orders?

Replace a mirror of the orders table each night.

Smallest and simplest, about 4 GB. But every past report can change without a trace, as Daniel’s did, and a row deleted in the store disappears from the copy too.

Append a full snapshot of the table every night.

Every past night can be read exactly, and the load is easy to check. But it costs about 1.5 TB a year, growing, mostly of rows that didn’t change.

Why this choice

Daniel needs to rerun past reports and explain every difference, so the mirror is out. Between the two ways of keeping history, changed rows give the same answers for about one hundredth of the storage, and Kartly’s orders table already sets updated_at on each update (an assumption of this scenario).

The choice changes with the table. A small table, such as Kartly’s product list, can take a full snapshot each night for a few megabytes. If the store can’t be trusted to set updated_at, or deleted rows matter, the load should read the database’s change log instead, which is change data capture. The loading patterns themselves are in Ingestion patterns.

Either way, history is only as fine as the load. An order placed at 10:00 and cancelled at 15:00 is seen once, as cancelled. The nightly copy never knew it was placed.

Try it yourself

See the overwrite and the history side by side. You need Python 3.11 or later and pip install duckdb==2.0.0. Save this as history.py and run python history.py. The database lives in memory, so nothing is written to disk 2.

Python
import duckdb

con = duckdb.connect(":memory:")

# The store's table: one row per order, changed in place.
con.sql("CREATE TABLE orders (order_id INTEGER, amount_inr INTEGER, status VARCHAR)")
# The analytical copy: the whole table again each night, stamped with the date.
con.sql("""CREATE TABLE orders_nightly
           (loaded_on DATE, order_id INTEGER, amount_inr INTEGER, status VARCHAR)""")


def nightly_load(day: str) -> None:
    # day is a date we type ourselves, never user input.
    con.sql(f"INSERT INTO orders_nightly SELECT DATE '{day}', * FROM orders")


# 10 November: three made-up orders are placed.
con.sql("INSERT INTO orders VALUES (1001, 1200, 'placed'), (1002, 800, 'placed'), (1003, 2500, 'placed')")
nightly_load("2026-11-10")

# 11 November: one order ships and one is cancelled.
con.sql("UPDATE orders SET status = 'shipped' WHERE order_id = 1001")
con.sql("UPDATE orders SET status = 'cancelled' WHERE order_id = 1002")
nightly_load("2026-11-11")

con.sql("SELECT * FROM orders ORDER BY order_id").show()
con.sql("""
    SELECT loaded_on,
           count(*) FILTER (WHERE status <> 'cancelled') AS open_orders,
           sum(amount_inr) FILTER (WHERE status <> 'cancelled') AS open_value_inr
    FROM orders_nightly
    GROUP BY loaded_on
    ORDER BY loaded_on
""").show()

Before you run it, predict: can the orders table tell you how many orders were open on 10 November? The output looks something like this (the layout varies by version):

Text
┌──────────┬────────────┬───────────┐
│ order_id │ amount_inr │  status   │
├──────────┼────────────┼───────────┤
│     1001 │       1200 │ shipped   │
│     1002 │        800 │ cancelled │
│     1003 │       2500 │ placed    │
└──────────┴────────────┴───────────┘
┌────────────┬─────────────┬────────────────┐
│ loaded_on  │ open_orders │ open_value_inr │
├────────────┼─────────────┼────────────────┤
│ 2026-11-10 │           3 │           4500 │
│ 2026-11-11 │           2 │           3700 │
└────────────┴─────────────┴────────────────┘

The store’s table only knows today. The nightly copy still knows that 10 November had 3 open orders worth ₹4,500. Now add a 12 November where order 1003 is cancelled, and predict both outputs before you run it.

When one job uses the other’s data

Reports on the store’s database slow checkout, as Introduction to data engineering showed. The opposite mix fails too, and more quietly.

“Only 3 left”, from last night’s copy

  1. The product team wants an “Only N left” badge on product pages. Stock counts are already in the analytical copy, and it’s easy to query, so they read it from there.
  2. At 01:00 the nightly load records 3 phones left.
  3. By 11:00 the phones have sold out in the store’s database, but the badge still says “Only 3 left”.
  4. Customers keep paying for a phone Kartly doesn’t have. Each order is cancelled and refunded the next day.
  5. On a busy day, every product page view is now also a query on a store built for a few large questions, not thousands of small ones.
Each side serves its own readers. Results the app needs from analysis go back through a separate copy, never as live queries.

The fix follows the two jobs. Anything a customer acts on now, such as stock, price or order status, is read from the store’s database, its . When the app does need an analytical result, like “bestsellers this week”, the pipeline computes it and copies the small result back into an app database. That copy back is called , covered in Reverse ETL.

The line between the two jobs is about the data, not the vendor. Snowflake, a company, bought Crunchy Data in 2025 to offer a PostgreSQL database for apps 3. It also says its Unistore “unifies transactional and analytical data within a single database” 3. Even when one company runs both, current-state data and history are still different tables with different jobs.

Where this shows up

Meera’s copy is up to a day old, which suits Daniel’s 07:00 report. A festival-sale dashboard needs something much fresher, and that is the next lesson.

Common mistakes

Building the analytical copy as a mirror

A nightly copy that overwrites itself inherits the store’s amnesia. Keep each load’s rows, stamped with when they were seen.

Joining to current values for a past question

Joining old orders to today’s customers table moves revenue between cities. Freeze the values a report groups by when the order is first loaded.

Serving the app from the analytical copy

It is up to a day old and built for a few large queries. Stock, price and order status come from the store’s database.

Check your understanding

Check yourselfAnswer in your head first, then reveal
A support agent needs the current status of order 48213907 while the customer is on the phone. Which data should the support tool read?Show answerHide answer
The store’s database, through a replica if needed. It is a point lookup on current state. Not the analytical copy: it may still say “shipped” for an order delivered this morning.
Check yourselfAnswer in your head first, then reveal
Daniel asks how many orders were open at 15:00 on 11 November. Meera’s copy appends changed rows once a night. Can she answer?Show answerHide answer
Not exactly. The copy knows each order’s state at each nightly load, not in between. A change made and changed back during the day is never seen; reading the database’s change log would capture it.
Check yourselfAnswer in your head first, then reveal
Kartly’s category list has 2,000 rows of about 500 bytes. Should the nightly load append only changed rows, or a full snapshot?Show answerHide answer
A full snapshot is fine: about 1 MB a night, or about 365 MB a year, and it needs no updated_at column. Changed-rows loading pays off for big tables like orders.
Check yourselfAnswer in your head first, then reveal
An analyst says the analytical copy wastes space by repeating each customer’s city on every order. Should Meera remove it and join to customers instead?Show answerHide answer
No. Joining to customers gives today’s city, so past reports would move as people move. The repeated city_at_order is the point: it records where the order was placed.

Summary

  1. Report data can’t be a plain copy of the store’s tables, because the store overwrites the past; the analytical copy keeps history, freezes values at the time of each event and joins ahead of time.
  2. Operational data serves the app one row at a time and must be current; analytical data serves questions over millions of rows and must be complete and reproducible.
  3. Mirroring loses history, full nightly snapshots cost about 1.5 TB a year at Kartly, and appending changed rows keeps the same history for about 13 GB.
  4. A nightly copy sees each row only once a night; changes in between need change data capture.
  5. Anything a customer acts on now is read from the store’s database; analytical results reach the app only as a small copy sent back.

Report a mistake

Tell us what’s wrong in this lesson and we’ll fix it.