Star Schema (Ralph Kimball)
A star schema organizes analytical data into one central fact table that records business events (an order line, a page view, a payment) and several dimension tables that describe the who, what, where and when of each event. Drawn on paper, the fact table sits in the middle and the dimensions surround it like the points of a star. It is the core of Ralph Kimball’s dimensional modeling and is still the most common shape for BI-facing tables in 2026, whether they live in Snowflake, BigQuery, ClickHouse or a lakehouse.
How it fits together
- The fact table holds one row per order line: foreign keys to dimensions plus numeric measures (quantity, amount). It is long and narrow.
- Dimensions describe the event: when it happened and what was sold. They are short, wide and full of text you filter and group by.
- Add where (store) and who (customer). Every dimension connects directly to the fact table, which is what makes it a star.
- A business question becomes a predictable query: filter and group by dimension columns, aggregate fact measures.
- Each dimension is one join away. Engines recognize this pattern (star-join optimization, join filters / bloom filters) and BI tools generate it automatically.
The four design steps
Kimball’s process is short and still the best way to start:
- Pick the business process. Sales, shipments, sign-ups. One process, one fact table.
- Declare the grain. State exactly what one fact row means: “one row per order line”, not “sales data”. Mixing grains in one table is the most common modeling bug.
- Identify the dimensions. Everything that describes a row at that grain: date, product, store, customer, promotion.
- Identify the facts. The numbers measured at that grain: quantity, amount, discount.
Facts and dimensions in detail
| Fact table | Dimension table | |
|---|---|---|
| Contains | Measures + foreign keys | Descriptive attributes |
| Shape | Billions of rows, few columns | Thousands to millions of rows, many columns |
| Changes | Append-mostly | Updated as the business changes |
| Example | fact_sales(date_key, product_key, amount) |
dim_product(product_key, name, category, brand) |
Fact tables come in three main flavors:
- Transaction facts: one row per event (an order line). The default.
- Periodic snapshot facts: one row per entity per period (account balance at end of each day).
- Accumulating snapshot facts: one row per process instance, updated as it moves through milestones (order placed, paid, shipped, delivered).
Measures are additive (amount: sum across any dimension), semi-additive (balance: sum across accounts, not across days) or non-additive (ratios: recompute from parts, never sum).
Dimensions use a surrogate key (product_key, an integer or hash generated by the warehouse) instead of the source system’s ID. This lets you keep history, merge several sources and handle “unknown” members with a dedicated row such as key -1.
Slowly changing dimensions
Customers move, products change category. How the dimension handles change decides whether old reports stay correct. The common options:
- Type 1, overwrite: update the row in place. Simple, but history is rewritten: last year’s sales now show the new city.
- Type 2, add a row: close the old version and insert a new one with its own surrogate key and validity dates. History is preserved.
- Type 3, add a column: keep
previous_citynext tocity. Only one level of history.
- Customer C-42 has one version in the dimension, valid "forever" (9999-12-31) and flagged current. (dbt snapshots leave
dbt_valid_toNULL instead by default; the idea is the same.) - The source system reports that C-42 moved to Toronto.
- Type 2 does not overwrite. It closes the old version:
valid_tois set andis_currentbecomes false. - A new row with a new surrogate key (205) carries the new city from 2026-03-01 onward.
- Facts point to the version that was true when the event happened. January revenue stays in New York, April revenue goes to Toronto.
In practice you rarely write Type 2 logic by hand: dbt snapshot, Delta / Iceberg MERGE patterns and most ELT tools generate it.
When to use a star schema
- BI dashboards and self-service analytics, where business users explore by dimension.
- Semantic layers (dbt Semantic Layer, Cube, LookML, Power BI models) map naturally onto facts and dimensions.
- Columnar warehouses are fast at scanning wide fact tables and joining small dimensions.
It is less suited to raw integration of many changing sources (look at Data Vault) or to operational systems that need normalized writes.
Some teams now flatten a star into one big table (OBT) for a specific dashboard. That is fine as a final serving layer, but keep the star underneath: it is the reusable, conformed model.
Common mistakes
- No declared grain, so a fact table mixes order-level and line-level rows and sums double count.
- Using source IDs as dimension keys, which makes history and multi-source merges painful.
- Measures in dimensions (for example
lifetime_revenueindim_customer) that go stale and get summed in the wrong place. - Not conforming dimensions:
dim_customerbuilt three different ways for three marts, so numbers disagree. - Snowflaking everything by reflex. Storage is cheap; extra joins cost users. See Snowflake Schema.
Learning Resources
Books
- The Data Warehouse Toolkit, 3rd Edition: Ralph Kimball and Margy Ross, the canonical reference
- Star Schema: The Complete Reference: Christopher Adamson
Articles and docs
- Kimball Group: Dimensional Modeling Techniques
- dbt: Snapshots (SCD Type 2)
- Databricks: What is a star schema?