Scrivio Interview library
DesignPrincipal6 min read · updated 12 November 2026

Over the next five years your company expects reporting needs to grow fast while the main transactional databases must stay small and fast. Lay out a strategy for derived data (materialized views, summary tables, caches, read models, warehouses) and who owns it.

Classify derived data by freshness and use: operational read models close to the services that own them, near-real-time aggregates, and historical analytics. Make change data capture or events the single path out of the OLTP databases, so derived data adds no load to the primary, keep materialized views in OLTP only for small, local needs with known refresh cost, and treat every derived dataset as a product with an owner, a freshness target and quality checks. Review costs and usage every year and retire what nobody uses.

Why this question is asked

A five-year data strategy question tests whether we can hold two goals that pull against each other: reporting that grows quickly and transactional databases that stay small and fast. Without a strategy, the default path is that every new report adds a materialized view, a summary table or a heavy query to the primary, until the primary's main job becomes analytics. Interviewers ask this to see whether we can give the company a simple model of derived data, clear paths for each kind, and an ownership structure that survives team changes. In this answer, we will define derived data, classify it, set the data path out of OLTP, decide where each technology belongs, and assign ownership and review.

1What We Mean by Derived Data

Derived data is any data computed from source data rather than entered by users or systems: materialized views, summary tables, caches, search indexes, read models built for a particular screen, and warehouse tables. The source of truth stays in the transactional (OLTP) databases owned by services. Derived data can always be rebuilt from that source, which is what makes it safe to move, reshape or delete.

The trouble is that derived data is cheap to create and expensive to keep. Each copy has a refresh cost, a freshness promise someone relies on, and a correctness question when it disagrees with the source. A strategy has to make creating derived data easy in the right place and hard in the wrong one.

2Classify by Freshness and Use

The first decision is which of three classes a need belongs to, because each class has a natural home. Operational read models serve the product itself: a customer's order history page, a product catalogue projection, a cache of prices. They need freshness in milliseconds to seconds and live close to the owning service, often in its own database or cache. Near-real-time aggregates serve operations: a live orders dashboard, fraud counters, stock alerts. They need freshness in seconds to minutes and are built from a stream of changes. Historical analytics serves analysis and finance: revenue over three years, cohorts, forecasting. It needs completeness and history more than freshness, and hours are fine.

Classifying each request this way turns a debate about technology into a short question: how fresh must it be and who uses it? The answer picks the class, and the class picks the platform.

Classes of derived data and their homes
ClassFreshnessTypical homeExample
Operational read modelms to secondsthe owning service, cache or its DBorder history page
Near-real-time aggregateseconds to minutesstream processing, real-time OLAPlive orders dashboard
Historical analyticshourswarehouse or lakehousethree-year revenue
Small local aggregateminutesmaterialized view in OLTPadmin counts, tiny tables
The class decides the platform; the last row is the exception, kept small on purpose.

3One Path Out of the OLTP Databases

The rule with the biggest effect is that data leaves the transactional databases through one path: change data capture (CDC) or published events. CDC tools such as Debezium read the database's write-ahead log and publish every committed change to a stream such as Kafka, without running queries on the primary. Services can also publish domain events through the outbox pattern, which writes the event to an outbox table in the same transaction as the business change, so events are never lost or invented.

From that stream, every kind of derived data is built: read models consume it, stream processors maintain live aggregates, and the warehouse loads it to keep history. The primary pays the cost of producing the change log once, which it already does for replication, and nothing else. New reports add load to the derived platforms, which are designed and scaled for it, instead of to the primary.

Step throughDerived data flows one way
  1. Consumersproduct screens, dashboards, analysts, finance
  2. Derived storesread models, real-time aggregates, warehouse
  3. Change streamCDC from the WAL, outbox events, in Kafka
  4. OLTP databasessource of truth, owned by services, kept small

4 layers, from the top down. Step through them one at a time.

Nothing reads OLTP tables for reporting; everything downstream is rebuildable from the stream.

4Where Materialized Views Still Belong

Materialized views are not banned; they are confined. Inside an OLTP database, they are fine for small, local needs whose refresh cost is known and stays low: an admin page counting open tickets by queue, or a lookup aggregated from a table of a few thousand rows. The rule is that a materialized view in OLTP needs an owner, a measured refresh time below a limit, say one minute, and a schedule that runs outside peaks. Anything larger, anything joining across domains, and anything needing history goes to the derived platforms.

This keeps the convenience of materialized views for small things while removing the pattern that slowly fills a primary with analytics.

5Ownership: Derived Datasets as Products

Every derived dataset has a named owner, a documented purpose and consumers, a freshness target, and quality checks. Treating it as a product means the owner commits to that freshness, tells consumers before changing its shape, and is alerted when it falls behind or fails its checks. Quality checks are simple to start with: row counts compared with the source, totals reconciled daily, no unexpected nulls in key columns.

Ownership follows knowledge. The producing service team owns the meaning of its change stream and events, because only it knows what a field means. A central data platform team owns the pipelines, the warehouse and the tooling. Teams that build a read model or a report own it, including its cost. This split avoids both extremes: a central team that owns everything and becomes a bottleneck, and no owner at all.

6Reviewing Cost and Usage Every Year

Derived data accumulates. Once a year, and whenever costs jump, we review every dataset's storage and compute cost, its consumers and its last use, and retire what nobody uses after notice. Because derived data can be rebuilt from the stream, retiring it is low risk. We also track a few strategic numbers: the share of reporting load still on OLTP databases, which should fall toward zero, the size of the primary databases, and how many datasets meet their freshness targets.

Over five years, this keeps the primaries small and fast because their only job is transactions, while reporting can grow as fast as the business needs on platforms built for it.

7Follow-up questions

Is CDC enough, or do we need domain events too?

Both have a place. CDC captures every change completely, including changes made outside the application, but it exposes table structure and lacks business intent. Domain events through an outbox carry meaning such as OrderCancelled with a reason. Analytics often starts from CDC; integrations between services are better served by events.

What about caches like Redis in this strategy?

A cache is an operational read model, owned by the service that serves it, with a short time to live or invalidation from the change stream. It belongs to the first class and follows the same rules: an owner, a freshness target, and the ability to rebuild it from the source.

How do you get teams to stop querying the primary for reports?

Make the right path easier: provide the warehouse tables and dashboards for common questions first, give new reports a template on the derived platform, and set a policy with a date after which reporting roles on OLTP databases are removed, while measuring and publishing the remaining OLTP reporting load.

8Conclusion

In this answer, we built a five-year strategy for derived data. We classified needs into operational read models near services, near-real-time aggregates and historical analytics, and gave each a home. CDC and outbox events became the single path out of OLTP, so new reporting adds no load to the primaries. Materialized views stay in OLTP only for small, local aggregates with known refresh cost. Every derived dataset has an owner, a freshness target and quality checks, and a yearly review retires unused ones.

What to say in the interviewAbout 90 seconds aloud

Open with

I would start by giving everyone the same model: derived data is anything computed from the source of truth, and it comes in three classes. Operational read models serve the product and need millisecond to second freshness, so they live with the owning service.

Then, if they want more

Near-real-time aggregates serve operations and need seconds to minutes, so they are built by stream processing. Historical analytics needs history and completeness more than freshness, so it lives in a warehouse or lakehouse.

The single most important rule is one path out of OLTP: change data capture from the write-ahead log, for example Debezium into Kafka, plus outbox events for business meaning. Everything derived is built from that stream, so new reports load the derived platforms, not the primary, and every derived dataset can be rebuilt.

Materialized views stay in OLTP only for small local needs with a measured, low refresh cost and an owner. Every derived dataset is treated as a product, with an owner, documented consumers, a freshness target and simple quality checks like reconciled totals.

Producing teams own the meaning of their data, a central platform team owns pipelines and the warehouse, and consumers own their reports and costs. Once a year we review cost and usage and retire unused datasets, and we track the reporting load left on OLTP, which should go to zero.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Over the next five years your company expects reporting needs to grow fast while the...": https://scrivio-interview-library.netlify.app/databases/stored-code/86860234a4/