Database denormalization: when should you accept duplicated data?
Denormalization is a deliberate design choice to copy or precompute some normalized data so a read path or response better fits a workload. Duplication also adds update responsibilities and the risk of inconsistency. Consider it only after the source tables and constraints are sound, a real read bottleneck has been measured, and you have a plan to synchronize or rebuild the copy.
What does a normalized design protect?
Suppose each product belongs to one category and a category ID determines its name. A normalized design keeps each fact in one place, for example product(product_id, category_id, name) and category(category_id, category_name). A product list that needs category names joins the two relations. Renaming a category then changes one row, avoiding stale copies of the name scattered across product rows.
This design makes the authoritative location of each fact clear. Primary and foreign keys can help ensure that a product refers to an existing category. A list query may need a join, but the existence of a join alone does not prove there is a performance problem. Measure the actual query plan and latency. Until then, denormalization is a hypothesis, not a demonstrated optimization.
When is copying or precomputing worth considering?
Consider it when these conditions are established:
Reads are measurably slow or under sustained read load, and query plans show that an index or query improvement alone is insufficient.
Many requests repeatedly calculate the same join or aggregate, and the business can state how fresh the response must be.
The business explicitly accepts an update interval and a defined period during which a copied value might be stale.
Someone owns synchronization or full rebuilds, can detect failures, and has a recovery procedure.
For example, imagine a product search screen that frequently reads a product name, category name, and aggregate review count together. This is an illustrative scenario, not a measurement from a particular service. A list where a category label can briefly be stale has different requirements from a checkout decision that needs the current price and inventory. Do not use a read model with tolerated refresh delay for a decision path where stale data could cause immediate loss or violate policy, such as payment, authorization, or stock allocation.
Which form can the duplicate take?
| Approach | When the value is updated | Suitable when and cost |
|---|---|---|
| Join normalized tables through a view | Reads the source when queried | Prefer this for reuse and clear freshness; do not assume an ordinary view stores results. |
| Materialized view | A scheduled job reruns the source query | Avoids recalculating joins or aggregates on every read, but results can be stale between refreshes. Refresh jobs and lag must be managed. |
| Application-maintained read table | With the source write or after event processing | Can match the response shape to reads, but the application owns synchronization, retries, duplicate handling, and rebuilds. |
| Copied column on a source row | In the source transaction or later synchronization | Simplifies reads, but every copy must be updated when the authoritative rule changes. |
In PostgreSQL 18, a materialized view stores query results in a table-like form, unlike an ordinary view, and its contents are not always current. That delay may be acceptable for analytics or dashboards that do not need the latest value. The PostgreSQL documentation gives an example that stores sales totals through the previous day and refreshes them nightly. PostgreSQL 18: Materialized Views
-- Illustrative only; not executed.
CREATE MATERIALIZED VIEW daily_sales AS
SELECT seller_no, invoice_date, sum(invoice_amt) AS sales_total
FROM invoice
WHERE invoice_date < CURRENT_DATE
GROUP BY seller_no, invoice_date;
CREATE UNIQUE INDEX daily_sales_key
ON daily_sales (seller_no, invoice_date);
-- A scheduler recomputes the full result at its chosen interval.
REFRESH MATERIALIZED VIEW CONCURRENTLY daily_sales;REFRESH MATERIALIZED VIEW replaces the materialized view’s contents with new results. CONCURRENTLY allows reads to continue during refresh, but it requires an eligible UNIQUE index that covers all rows and column names only, and the view must already be populated. Only one refresh at a time may run for a given materialized view. This is a full refresh, not an incremental update. See the PostgreSQL 18 REFRESH MATERIALIZED VIEW reference and CREATE MATERIALIZED VIEW reference for the storage and refresh behavior.
What gets harder after denormalization?
When copies disagree, the system needs a rule for which one is authoritative. If the source update succeeds but an event handler stops, a read table can remain stale. If an event is processed twice, an aggregate can be counted twice. At minimum, define these operating rules:
Designate the source of truth. If callers can update a copy directly, the system gains another path that can disagree with the source.
Choose whether source and copy change in the same transaction or asynchronously through an outbox/event, and document each option’s atomicity and lag.
Account for redelivery and concurrent processing with idempotency keys, version checks, or recomputation so duplicates and out-of-order updates are handled.
Prepare a way to rebuild the copy from the source, monitor lag and failure, and validate it after recovery.
Separate reads that can tolerate stale copies from decisions that must consult the authoritative source.
A value such as the product name or delivery address as it stood when an order was placed is different from a duplicate added only for speed. If a receipt must preserve how the order was described at that time even after the product record changes, the order snapshot can be modeled as a separate business fact. State clearly in the schema and documentation which point in time the value represents.
How should you decide, step by step?
Reproduce the slow request or load and identify the bottleneck with query plans and measurements. If the problem is not established, measure before copying schema data.
Check whether indexes, removing unnecessary columns/rows, or a better query shape can solve it.
For the remaining bottleneck, document acceptable freshness, read/write ratio, rebuild feasibility, and business impact of inconsistency.
Choose the simplest approach that meets those requirements. Use a normal view or normalized query when freshness matters; consider a materialized view when periodic refresh is acceptable; consider a derived table only when a tailored low-latency read model is needed and its synchronization burden is supportable.
After rollout, observe write overhead, refresh lag, recovery time, and source-copy agreement as well as read improvement. Keep a way to remove the copy if benefits do not justify maintenance.
Normalization clarifies where facts and constraints live. Denormalization accepts some duplication or precomputation for a read workload. Accept that trade only when the gain is measured, freshness requirements are explicit, and synchronization and recovery have been verified. Relational-schema normalization lectures also describe tradeoffs among redundancy reduction, joins, and dependency preservation during decomposition. University of Wollongong: Database Normalization
Scope and sources
[University of Wollongong CSCI235: Database Normalization lecture notes](https://documents.uow.edu.au/~jrg/235/slides/03databasenormalization/03databasenormalization.html)
[PostgreSQL 18: Materialized Views](https://www.postgresql.org/docs/18/rules-materializedviews.html)
[PostgreSQL 18: REFRESH MATERIALIZED VIEW](https://www.postgresql.org/docs/18/sql-refreshmaterializedview.html)
[PostgreSQL 18: CREATE MATERIALIZED VIEW](https://www.postgresql.org/docs/18/sql-creatematerializedview.html)
Sources were checked on 2026-11-22. General denormalization choices apply to the relational model; materialized-view behavior and SQL details here are specific to PostgreSQL 18. The product-search and order-snapshot scenarios are illustrative. No SQL was executed and no performance measurements were taken.