Catalog My learning Blog
Event-Driven Architecture Course: Event Sourcing and CQRS · Phase 3 · Lesson 15 · 8 min read

CQRS Read Models: Denormalized Views

On this page
  1. Learning Objective
  2. Concept Explanation
  3. Worked Example: One Stream, Three Read Models, Three Stores
  4. Real-World Examples
  5. Review Questions & Answers

Learning Objective

Design read models that serve specific queries rather than general-purpose entities, choose a read store that matches the query shape, and accept duplication deliberately as the mechanism that makes the read side fast and independently evolvable.

Concept Explanation

Once the read side is a separate model, the design rules that govern it are almost the inverse of the ones that govern the write side, and the most important of them is that duplication is a feature. Normalization exists to prevent update anomalies, which are a write-side concern; a read model is never updated by a user, only regenerated from the authoritative source, so a fact can appear in five read models without any risk of them disagreeing in a way that matters. Denormalizing the customer's display name into the order summary table is not a compromise, it is the point.

The governing design question therefore stops being what are the entities and becomes what does this screen or this API endpoint need to render, in one query, with no joins. A read model is built backwards from a query. If a page shows an order with its items, the customer name, the shipping status, and a loyalty tier, the read model is a single row, or a single document, containing all of that. The test of a good read model is that its query is a primary key lookup or a single indexed range scan, and that adding a field to the screen does not require a new join.

This freedom extends to the choice of store, which is one of the larger practical benefits of the separation. The write side may be a relational database chosen for transactional integrity, while the read side uses whatever serves each query best: a document store for deeply nested aggregates rendered as one object, a search engine such as Elasticsearch for faceted and full-text queries, a key-value cache for the hottest lookups, a columnar warehouse for analytics, or a graph database for relationship traversal. The same events can feed all of them simultaneously, and none of those stores needs to be able to enforce a single invariant, because the write side already did.

The read side also inherits an unusual property: it is disposable, and that changes how freely it can be evolved. Because every read model is derived, a new screen means a new read model built by replaying history rather than a migration of the shared schema, and a mistake in one read model affects only the queries it serves. This is what lets a team add a projection for a new feature without negotiating a change to a table that eight other features depend on, which in a conventional shared schema is often the slowest step in shipping anything.

The cost is that read models must be maintained, monitored, and kept honest. Every one of them is code that must handle every relevant event type, a checkpoint that must advance, a lag metric that must be watched, and a rebuild procedure that must actually have been tested. Read models drift when a new event type is added and an older projection silently ignores it, which produces a view that is subtly and permanently wrong rather than obviously broken. The practical defenses are to fail loudly on unrecognized event types during development, to periodically reconcile a sample of read-model rows against a fold of the authoritative source, and to treat a projection as owned by the feature team that depends on it rather than as shared infrastructure nobody watches.

Query shapeRead store that fitsRead model shape
Render one entity page with everything on itDocument store or a wide relational tableOne document or row per entity, fully denormalized
Faceted search and full-text filteringElasticsearch or OpenSearchOne indexed document per searchable item with facet fields
Hot lookup by key at very high volumeRedis or another key-value cacheSerialized ready-to-return payload keyed by id
Aggregation over large ranges for reportingColumnar store or warehousePre-aggregated rollups by day, region, or cohort
Relationship traversal, recommendationsGraph databaseNodes and edges derived from relationship events
Simple list with a few filtersThe same relational database as the write sideA denormalized table, no separate store needed

Worked Example: One Stream, Three Read Models, Three Stores

Each model below answers one question well and would answer the others badly. That is the intended outcome, not an accident of design.

SQL
// The same OrderPlaced, PaymentCaptured, and ShipmentDispatched events feed
// three read models, each in a store chosen for its query shape.

// --- 1. Order detail page: one row, zero joins, primary key lookup. ---
CREATE TABLE rm_order_detail (
  order_id        TEXT PRIMARY KEY,
  customer_id     TEXT NOT NULL,
  customer_name   TEXT NOT NULL,      -- duplicated on purpose
  customer_tier   TEXT NOT NULL,      -- duplicated on purpose
  status          TEXT NOT NULL,
  placed_at       TIMESTAMPTZ NOT NULL,
  items_json      JSONB NOT NULL,     -- the whole line item list, inline
  total_cents     BIGINT NOT NULL,
  carrier         TEXT,
  tracking_number TEXT
);
-- SELECT * FROM rm_order_detail WHERE order_id = $1;   one row, done.

// --- 2. Faceted order search: an Elasticsearch document per order. ---
{
  "order_id": "9f12",
  "customer_name": "Ana Ferreira",
  "status": "shipped",
  "placed_at": "2026-03-04T10:22:31Z",
  "total_cents": 17700,
  "skus": ["KB-88", "MS-12"],
  "product_names": ["Mechanical Keyboard", "Wireless Mouse"],   // for full text
  "region": "EU",
  "tier": "gold"
}
// Faceted filter by status, tier and region with free text over product_names,
// which the relational model above could not do without a painful join.

// --- 3. Finance rollup: pre-aggregated, never queried by order at all. ---
CREATE TABLE rm_daily_revenue (
  day         DATE NOT NULL,
  region      TEXT NOT NULL,
  order_count INT    NOT NULL DEFAULT 0,
  gross_cents BIGINT NOT NULL DEFAULT 0,
  PRIMARY KEY (day, region)
);

// The customer's display name is stored in two of the three. When a customer
// renames themselves, a CustomerRenamed event updates both. They are not
// sources of truth, so there is no anomaly to prevent, only a projection to run.
A single write-side event stream fanning out to three differently shaped read models, a denormalized relational detail table, a search index document, and a pre-aggregated rollup table, each annotated with the one query it is built to answer.
A single write-side event stream fanning out to three differently shaped read models, a denormalized relational detail table, a search index document, and a pre-aggregated rollup table, each annotated with the one query it is built to answer.

Real-World Examples

  • Elasticsearch is most often deployed exactly as a CQRS read model: the authoritative data lives in a relational database and a separate pipeline indexes it into Elasticsearch for search and faceting, because a relational store cannot serve full-text and faceted queries at the same cost. Teams that adopt this pattern are practicing the read-side half of CQRS whether or not they use the term, including the eventual consistency it entails, which is why a newly saved record is often searchable a second or two after it is saved.
  • Netflix has described a video metadata architecture in which a normalized authoritative store publishes changes that are materialized into denormalized, precomputed data sets pushed out to the services that serve them, so that request-time work is a lookup rather than a join. The design rationale they give is the one in this lesson: at the read volumes involved, the only affordable query is one that was answered in advance, and the way to answer it in advance is to build a read model shaped for it.
Best PracticeBuild a read model per query, and let the same fact appear in as many of them as it is needed in. Duplication is dangerous only where updates happen, and read models are never updated by users, only regenerated from the authoritative source, so the anomalies that normalization exists to prevent cannot occur here.

Review Questions & Answers

Because normalization exists to prevent update anomalies, and the read side does not take updates. On the write side, storing a customer name in two places means an update can change one and miss the other, leaving the database internally inconsistent with no way to tell which copy is right. On the read side, every copy is derived from the same authoritative source and regenerated by the same projection, so if a name changes the projection updates every copy, and if it ever gets them wrong the fix is to rebuild rather than to reconcile. What normalization costs, joins at query time, is paid on every single read, which is the highest-volume operation in most systems.

It means each query workload can use a store whose data model matches it, a search engine for faceted text, a cache for hot key lookups, a columnar store for aggregation, rather than forcing every access pattern through one engine chosen for transactional integrity. It is safe specifically because the read store enforces no invariants and holds no authoritative data: it can be wrong, lost, or rebuilt with no risk to correctness, since the write side has already enforced every rule and still holds the truth. Using a search engine as a system of record, by contrast, is the failure mode this separation is designed to prevent.

Because it produces a view that is quietly and permanently wrong while every health signal looks fine. The projection keeps running, the checkpoint keeps advancing, the lag metric stays at zero, and the data is simply missing whatever the new event type conveyed, which may not be noticed for months and may be discovered by a customer or an auditor. A crash is loud, stops the checkpoint from advancing, pages someone, and is fixed by deploying a handler and resuming from the last good position with no data loss at all, since the events are still there.

It removes the shared-schema negotiation that is often the slowest part of a change. In a conventional system, a new screen that needs data in a different shape means altering tables that other features depend on, coordinating a migration, and testing the blast radius. With derived read models, the new screen gets its own model, built by replaying existing history, affecting nobody else, and deletable if the feature is abandoned. The team that owns the feature owns the projection, which turns a cross-team schema change into a self-contained piece of work.