Data warehouse

On this page 7

A data warehouse is a central analytical database that stores cleaned, integrated and historical data from many operational systems in a structure optimized for queries, reporting and analysis rather than for recording individual transactions. In data engineering, it is the destination where pipelines deliver trusted, modeled data that business intelligence tools, analysts and data scientists query directly.

The classic definition describes a warehouse as subject-oriented, integrated, time-variant and non-volatile: data is organized around business subjects such as customers or orders, reconciled into consistent definitions, kept with its history and changed mainly by controlled loads rather than ad hoc updates.

How a data warehouse works

A data warehouse works by separating analytical workloads from operational systems. Source databases, applications and files are extracted on a schedule or continuously, then transformed and loaded through ETL or ELT pipelines into a staging area, an integrated core layer and finally presentation models that users query.

Most modern warehouses use columnar storage, which stores each column separately and compresses it heavily. An aggregate over two columns of a billion-row table reads only those columns, so scans are far cheaper than in a row-oriented transactional database. Massively parallel processing (MPP) spreads the work across many nodes, and cloud platforms add the separation of storage and compute, so several independent compute clusters can read the same data.

The layered structure below is common, although names vary between teams and platforms.

LayerPurposeTypical content
Staging or rawLand source data with minimal changeCopies of source tables, load timestamps
Integration or coreReconcile keys, types and definitionsConformed customers, products, dates
Presentation or martsServe specific analytical needsStar schemas, aggregates, metrics
Semantic layerDefine shared business metricsMeasures, hierarchies, access rules
Typical layers inside a data warehouse

Data modeling approaches in a warehouse

The model decides how understandable and how fast a warehouse is. Dimensional modeling organizes data into fact tables that hold measurable events such as sales lines and dimension tables that describe them, such as customer, product and date. Joined in a star schema, they let analysts filter and group with simple, predictable queries.

History is handled with slowly changing dimensions (SCD). Type 1 overwrites an attribute, Type 2 adds a new row with validity dates so past reports still show the old value, and other types mix both. Choosing the wrong type is a frequent cause of reports that change retroactively.

ApproachCore ideaBest suited to
Dimensional (Kimball)Star schemas built per business processFast delivery of analyst-friendly marts
Normalized enterprise (Inmon)Third normal form core feeding martsLarge organizations needing one integrated model
Data VaultHubs, links and satellites with full historyMany changing sources, strong auditability
One big tableWide denormalized tables per use caseSimple dashboards on columnar engines
Main warehouse modeling approaches

These approaches are not exclusive. A common pattern uses Data Vault or a normalized core for integration and dimensional marts on top for consumption, accepting extra pipeline work in exchange for traceability and flexibility.

A data warehouse differs from neighboring systems mainly in when structure is applied and what workload it serves. It enforces a schema on write, whereas a data lake stores raw files and applies structure on read, and a lakehouse adds warehouse features such as transactions and table schemas on top of open file formats in object storage.

SystemData shapePrimary workloadTypical users
Data warehouseModeled, cleaned tablesSQL analytics and reportingAnalysts, BI tools
Operational database (OLTP)Normalized current recordsMany small reads and writesApplications
Data lakeRaw files in many formatsExploration, data science, archivesEngineers, data scientists
LakehouseOpen table formats on object storageMixed SQL and machine learningShared platform teams
Data martSubset for one domainDepartmental reportingSingle business unit
Data warehouse versus neighboring systems

In practice the boundaries blur. Cloud warehouses can query external files, and lakehouse engines offer warehouse-grade SQL performance, so the choice increasingly depends on governance, cost model and existing skills rather than on raw capability.

Designing and operating a data warehouse

Good warehouse design starts from business questions and grain, not from source tables. The grain states exactly what one row of a fact table represents, for example one order line per day, and every later decision about keys, measures and aggregation depends on it.

  • Use surrogate keys in dimensions so source key changes do not break history.
  • Partition or cluster large fact tables by date or another common filter to limit the data scanned.
  • Load incrementally with idempotent pipelines that can rerun without creating duplicates.
  • Track data freshness and row counts for every load and alert on deviations.
  • Apply role-based access control and column masking for personal or sensitive fields.

The following decision table summarizes common design choices and the reasoning behind them.

SituationRecommended choiceReason
Reports must show history as it wasSCD Type 2 dimensionsPast facts keep their original context
Dashboards refresh every few minutesIncremental or streaming loadsFull reloads are too slow and costly
Queries usually filter by datePartition by datePruning reduces scanned data sharply
Many teams define the same metricCentral semantic layerOne definition prevents conflicting numbers
Cloud costs grow unpredictablyWorkload isolation and quotasHeavy jobs cannot starve or inflate others
Practical design decisions

Limitations and common mistakes

A data warehouse is not a replacement for operational databases and is a poor fit for high-frequency single-row updates, unstructured content such as images, or sub-second transactional lookups. Latency also matters: a warehouse loaded nightly cannot support decisions that need data from the last minute.

The most expensive failures are organizational rather than technical. Warehouses without clear metric ownership accumulate several versions of revenue or active users, and trust collapses once two reports disagree. Copying every source table without modeling produces a swamp of raw tables that analysts cannot use safely.

Cost is the other recurring problem. On consumption-priced cloud platforms, unfiltered scans, runaway dashboards and oversized clusters dominate the bill, so query monitoring and sensible partitioning belong in the design from the start rather than after the first invoice.

The simple explanation

Picture a company where sales, billing and support each keep their own records in separate systems. Asking a simple question such as which customers bring the most profit would mean collecting files from every department and reconciling them by hand.

A data warehouse does that collecting and reconciling automatically and keeps the result in one place. It is like a well-organized central library of company facts: everything arrives regularly, is checked and labeled the same way, and old editions are kept. The key point is that everyone asks questions against the same trusted copy, so the answers agree.

How it is used in practice

A mid-sized online retailer runs an order database, a payment service, a customer support tool and an advertising platform. Each night, ELT jobs load roughly two years of order history plus the previous day of changes into a cloud data warehouse. Engineers model an order line fact table at the grain of one product per order, with dimensions for customer, product, date and marketing channel, and keep customer address changes as Type 2 history.

Finance, marketing and operations then use the same tables. Finance reconciles revenue against payments, marketing measures return on ad spend per channel, and operations tracks late deliveries by region. Because the order fact table is partitioned by date, the daily dashboard query scans only recent partitions. The outcome is one agreed revenue figure across departments and monthly reporting that drops from several days of spreadsheet work to an automated refresh each morning.