My account

Data Ownership

Each piece of live data has exactly one owner that writes it. Other parts ask the owner, or keep a read-only copy fed by events; they never read or write its tables. Report data is a different problem: a central warehouse, a raw lake, or a data mesh where each domain publishes its data as a product.

Not reviewedWritten with AI helpReading time: 13 minOnline shop exampleOperational and analytical dataData mesh

Author: bezzad

Contents

The problem: everybody wants everybody’s data

Our online shop is split into modules: Catalog, Order, Payment, Inventory, Shipping. Each one has its own tables. Soon the questions start:

  • The Order module needs the product name and price. They live in Catalog.
  • The Warehouse app wants to update the stock count. Inventory also updates it.
  • The finance team wants a monthly report that joins orders, payments and products.

Each question has an easy answer: “just read the other tables”. That easy answer slowly turns the system into one big tangle. This lesson shows better answers.

Two kinds of data

  1. Operational data. The live state the shop runs on: carts, orders, stock. It must be correct now. Many small reads and writes.
  2. Analytical data. History used to answer questions: “Which products sell best in winter?”. It can be minutes or hours old. Few, very large reads.

They have different needs, so we solve them in different ways.

Rule 1: each piece of data has one owner

The owner is the only part that writes that data, and it keeps the business rules for it. Others never touch its tables.

Two writersOrderWarehouseStock tableWho owns the rules? Who is right?One ownerOrderWarehouseInventorythe only writerReserve 2Received 50Others ask; the owner checks the rules.
With two writers, nobody owns the rules. With one owner, others send requests and the owner decides.

Why?

  1. Rules live in one place. “Stock can never go below zero” is checked by Inventory only.
  2. The owner can change its tables freely. Nobody outside depends on them.
  3. There is one truth. When two parts write the same row, it is unclear who is right.

What if two parts need to change the same data? Pick one owner. The other part asks the owner: “reserve 2 items”, “50 items arrived”. If a table holds data of two owners, it is often two things in one table. Split it.

Rule 2: others read through the owner

When Order needs product prices, there are three ways:

1. Ask the ownerOrderCatalogAPI call+ always fresh− fails if Catalog is down2. Keep a local copyOrder+ copy of pricesCatalogevents+ fast, works alone− a few seconds old3. Read its tablesOrderCatalog tables+ easy today− breaks on every change
The first two keep the owner in charge. The third one couples Order to Catalog's private tables.
Way Fresh? Works if owner is down? Coupling Good when
1. Ask the owner (API) Always No Contract You need the exact value now, like the final price at payment
2. Local copy fed by events A few seconds old Yes Contract (the events) You read often and small delays are fine, like product names in order history
3. Read its tables Always Depends Intrusive Almost never; maybe a short first step when splitting an old monolith

A few notes on the local copy:

  • The copy is read-only. Only the owner changes the real data.
  • Keep only the fields you need. An order needs the product name and price, not the full product.
  • Save the price inside the order at the moment of buying. Later price changes must not change old orders. This is not only a copy, it is a business fact.

Who owns what? Use the business

Draw ownership from the business, not from the database schema:

  • The thing that creates the data and checks its rules is usually the owner.
  • “Product” can mean different things: name and photos (Catalog), count on the shelf (Inventory), weight and size (Shipping). Each module owns its own part. This is the idea of the bounded context in DDD.

Analytical data: the report problem

Finance wants one report from five modules. Running big queries on each live database is a bad idea: it slows down checkout, and it couples the report to private tables.

So we copy data into a separate place made for reports. There are three main shapes:

WarehouseOrderPayCatalogCentral ETL (data team)One big warehouse+ one clean model− one team is the bottleneckLakeOrderPayCatalogRaw files, as they areClean later, per use+ cheap and flexible− can become a "swamp"Data meshOrderPayCatalogdataproductdataproductdataproductReports join productsShared platform and rules+ owners know their data− needs mature teams
All three move data away from the live databases. They differ in who owns the cleaning and the meaning.
  1. Data warehouse. A central data team pulls data from all modules (ETL: extract, transform, load) into one clean model. Great for standard reports. But the central team becomes a bottleneck, and it must understand every domain.
  2. Data lake. Dump the raw data cheaply, and clean it later for each use (reports, machine learning). Flexible. But without owners and rules, it becomes a “data swamp” that nobody trusts.
  3. Data mesh. Each domain team publishes its analytical data as a data product, with a shared self-service platform and a few common rules for everyone. The people who know the data are responsible for it.

A good data product is like a good API:

  • Easy to find (in a catalog) and easy to understand (documented meaning of each field).
  • Trustworthy: it states how fresh it is and checks its own quality.
  • Has a contract: its schema changes carefully, like any public API.

Many companies use a mix: domain-owned data products, plus a small central layer for company-wide numbers, plus a lake for raw data and machine learning.

Reports are eventually consistent: Report data arrives late, sometimes in pieces. Mark a day as “complete” only when all sources have arrived, and do not compare an incomplete day with full days.

Common mistakes

Mistake Result The right way
Two modules write the same table Broken rules and unclear truth. One owner; others send requests.
Reading another module’s tables Their change breaks you. Ask the owner, or keep a copy fed by events.
Copying the full object “just in case” Strong model coupling. Copy only the fields you use.
Heavy reports on the live database Slow checkout at the worst time. A separate analytical store.
A data lake with no owners A swamp of data nobody trusts. Owners, contracts and quality checks.

Summary in six lines

  1. Operational data runs the system now; analytical data answers questions later.
  2. Each piece of live data has exactly one owner that writes it and keeps its rules.
  3. Others ask the owner, or keep a small read-only copy fed by events.
  4. Reading another module’s tables is intrusive coupling; avoid it.
  5. Report data lives in a separate store: warehouse, lake, mesh, or a mix.
  6. In a data mesh, domains publish data products with owners, contracts and quality checks.

Done reading this lesson?Mark it as finished so it shows in your lessons list and report card.