A database built for analysis: clean, organised data for reports and dashboards.
A data warehouse is a database built for analysis, not for running the app. It holds clean, organised data from many sources, so people can ask big questions and get reports fast.
Your app database is built for OLTP (online transaction processing): many small, fast operations such as "add this order" or "get user 42". A warehouse is built for OLAP (online analytical processing): a few huge questions such as "what was revenue per region per month for the last three years?"
Running those huge questions on the app database would slow the app for everyone. So the data is copied into a separate warehouse, cleaned and shaped on the way (schema on write), and kept with its history. Analysts and dashboards then query the warehouse without touching the app.
Two ideas make warehouses fast. First, columnar storage: each column is stored together, so a query that needs 3 of 40 columns reads only those 3, and similar values compress well. Second, parallel processing: the work is spread over many nodes, each scanning its own slice.
| Model | How it looks | Good and bad |
|---|---|---|
| Star schema | One fact table joined to flat dimension tables | Simple, fast queries. Some repeated data in dimensions. |
| Snowflake schema | Dimensions are split into further tables | Less repeated data. More joins and harder to read. |
| Wide denormalized table | Everything pre-joined into one big table | Very fast, easy for analysts. Large and harder to change. |
| OLTP (app database) | OLAP (warehouse) | |
|---|---|---|
| Typical query | Get or change one row | Scan and add up millions of rows |
| Storage layout | Row based | Column based |
| Data | Current state | History, over many years |
| Users | App and customers | Analysts and dashboards |
| Updates | Constant, small | Loaded in batches or micro-batches |
| Goal | Fast and correct transactions | Fast answers over big data |
A simplified model with no random numbers: every value is 8 bytes, columns compress about 4 to 1, a node scans about 500 MB per second, and a lookup is served by an index. Real engines also skip data with statistics and partitions, so real numbers differ.
| Term | Meaning in easy words |
|---|---|
| Data warehouse | A database built for analysis, holding cleaned, organised data from many sources |
| OLTP | Online transaction processing: many small reads and writes for running the app |
| OLAP | Online analytical processing: big queries that summarise lots of data |
| Fact table | The central table of events or measurements, such as one row per sale |
| Dimension table | A table that describes a fact: who, what, where, when |
| Star schema | A fact table with dimension tables around it, joined by keys |
| Columnar storage | Storing each column together so queries read only the columns they need |
| Grain | What exactly one row of a fact table stands for |
| Data mart | A smaller warehouse or set of tables for one team, such as finance |
| Slowly changing dimension | A way to keep history when descriptive data (like a customer's city) changes |
| ELT | Load raw data first, then transform it inside the warehouse |
| Choice | We gain | We lose |
|---|---|---|
| Schema on write | Clean, trusted data | Less flexibility, unplanned fields are lost |
| Star schema | Simple, fast queries | Some repeated data and upfront design |
| Snowflake schema | Less repeated data | More joins, harder to query |
| Batch loads | Simple and cheap | Data is not fresh |
| Streaming or micro-batch loads | Fresher data | More complexity and cost |
| Pre-built summary tables | Instant dashboards | Extra storage and a job that keeps them current |