← Glossary

Data

Data warehouse

A data warehouse is a central database that holds copies of data from many systems, organized for analysis and reporting rather than for running applications.

Data warehouse architecture diagram with source systems feeding batch and streaming pipelines into staging, core and data mart layers, read by ML models, analysts and BI dashboards
A data warehouse in context. Pipelines copy data from the source systems into staging, SQL transforms it into core tables and data marts, and analysts and dashboards read from the right layer.

Teams build a data warehouse when the questions they need to answer span more than one system. Revenue by product by region needs the orders database, the catalog and the CRM, and nobody wants to join them by hand every Monday.

When do you need a data warehouse?

  • Reporting across systems. The same customer appears in billing, support and marketing tools, and the business wants one view.
  • Protecting production. Analytical queries scan whole tables and compete with the application for the same database.
  • Keeping history. Application databases overwrite rows. A warehouse keeps every version.
  • One definition of each metric. When “active customer” is computed in one place, every dashboard agrees.

What are the parts of a data warehouse?

The diagram at the top of this page shows a typical setup. The warehouse is the green region, but it only works with what surrounds it.

  • Sources. The systems of record: application databases, SaaS tools, spreadsheets and event streams.
  • Pipelines. Jobs that copy data in. Batch loads run on a schedule, usually nightly, while streaming loads land events within minutes. See ETL pipeline for how these are built and data pipeline architecture for how batch and streaming fit together.
  • Staging. Raw copies of the source tables, loaded as they are. Only the next layer reads from here, which makes reloads safe.
  • Core tables. Cleaned, deduplicated and joined tables that model the business: customers, orders, subscriptions. This is where data modeling happens.
  • Data marts. Subject-area tables built for one audience, such as a sales mart, often in a star schema.
  • Consumers. BI dashboards, analysts writing SQL and ML pipelines, each reading from the layer that suits them.

How does a data warehouse compare with a data lake, a lakehouse and a database?

The names get used loosely. The practical differences are what is stored, when the schema is applied and what the system is tuned for.

SystemWhat it storesSchema appliedTuned for
Application databaseCurrent state of one applicationOn write, strictlyMany small reads and writes
Data warehouseStructured tables from many systems, with historyOn loadLarge scans and aggregations
Data lakeRaw files of any format, cheaplyOn readStorage and flexibility
LakehouseFiles in the lake with table metadata on topOn load, looselyWarehouse queries over lake storage

A lakehouse is a data lake with a table format layered over the files, so SQL engines can treat them as warehouse tables. There, the staging, core and mart layers described above are usually called bronze, silver and gold, the medallion architecture.

What is a star schema?

A star schema is the most common way to organize a data mart. It separates measurements from the things they describe.

Star schema diagram for a sales data mart with a central fact_sales table joined to dim_date, dim_product, dim_customer and dim_store dimension tables
A star schema. The fact table in the middle holds one row per sale, and each dimension table describes one thing a sale can be grouped by.
  • Fact table. One row per event, such as a sale, with numeric measures like quantity and revenue and a foreign key to each dimension.
  • Dimension tables. One row per thing you group by: a date, a product, a customer, a store. They hold descriptive columns and change slowly.

A query like “revenue by product category by month” joins the fact table to two dimensions and sums one column, which the warehouse does quickly over billions of rows. The dimensions are deliberately denormalized compared with an application database schema, because the goal is simple joins, not avoiding duplicate text. The diagram uses standard ERD notation.

How does data move through a data warehouse?

Follow the hero diagram left to right. The app database, CRM and spreadsheets are copied nightly by a batch job, and the event stream is loaded continuously. Both land in staging as raw copies.

Inside the warehouse, SQL transformations turn staging into core tables, and aggregations turn core tables into data marts. Each arrow is a job someone can rerun, so when a dashboard number looks wrong you can trace it back one layer at a time, which is what data lineage tools automate. On the right, ML models and analysts read the core tables, and BI dashboards read the marts.

How do you build a data warehouse?

  1. Start from the questions. List the ten metrics the business needs most, and the sources each one draws on.
  2. Load sources raw. Copy the tables you need into staging without changing them. Resist cleaning on the way in.
  3. Model the core. Define customers, orders and the other business entities once, with tests for uniqueness and referential integrity.
  4. Build marts for each audience. Give finance and sales their own star schemas with the grain and names they use.
  5. Point consumers at the right layer. Dashboards read marts, analysts read core, nobody reads staging.
  6. Diagram it. Keep an architecture diagram of the sources, layers and consumers, and a data flow diagram for any pipeline that is not obvious.

What are common data warehouse mistakes?

  • Transforming on the way in. If the raw copy is lost, every bug in a transformation is unrecoverable. Load first, transform in SQL.
  • One giant layer. Without staging, core and marts, every table depends on every other, and one change breaks dashboards nobody knew about.
  • Modeling the source system. A warehouse that mirrors the CRM’s tables is as hard to query as the CRM. Model the business instead.
  • No owner for definitions. When each team computes revenue its own way, the warehouse becomes one more source of disagreement.
  • Skipping cost controls. Cloud warehouses charge per scan, and one unbounded dashboard query can cost more than the pipelines.

What tools help with a data warehouse?

  • Cloud warehouse platforms. Managed services that separate storage from compute, so you pay for scans rather than servers.
  • Transformation and orchestration tools. Frameworks that run SQL models in dependency order and test them, plus schedulers that run the loads.
  • AI diagramming tools. Tools like Eraser turn a description of your sources, layers and consumers into an architecture diagram, and a schema into a database schema diagram, which is the quickest way to document a warehouse that already exists.

For more on this kind of diagram, see data model diagrams.

Frequently asked questions

  • What is the difference between a data warehouse and a database?

    A database behind an application is tuned for many small reads and writes, one record at a time, and holds only the current state. A data warehouse is tuned for scanning millions of rows at once, holds history and combines data from many applications. The schemas and workloads differ.

  • What is the difference between a data warehouse and a data lake?

    A data lake stores raw files of any shape, cheaply, with the structure applied when someone reads them. A data warehouse stores structured tables with a schema applied when data is loaded, which makes queries faster and governance easier. Many teams run both: the lake keeps everything, and the warehouse holds the curated part analysts query.

  • What is ETL versus ELT in a data warehouse?

    In ETL, a pipeline transforms data before loading it into the warehouse. In ELT, the pipeline loads raw copies first and the transformation runs as SQL inside the warehouse. Cloud warehouses made ELT the default, because compute is elastic and keeping the raw copy makes every transformation reproducible.

  • Do small companies need a data warehouse?

    Not at first. While one application database holds everything and queries against a read replica are fast enough, a warehouse adds cost without benefit. The usual trigger is the second or third source system, when joining data across them by hand becomes a weekly chore, or when reporting queries start to slow the production database.

Turn a description of your data stack into an architecture diagram.