$ kimball --design sales_mart

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

$ SELECT ... FROM fact_sales JOIN dim_*
A star schema assembles around one fact table
FACT_SALES date_key product_key store_key customer_key quantity amount measures DIM_DATE date_keydate monthis_holiday DIM_PRODUCT product_keyname categorybrand DIM_STORE store_keycity regionopened_on DIM_CUSTOMER customer_keyname segmentcity SELECT d.month, p.category, SUM(f.amount) FROM fact_sales f JOIN dim_date d USING (date_key) JOIN dim_product p USING (product_key) GROUP BY d.month, p.category; 2 joins, 1 hop each
  1. The fact table holds one row per order line: foreign keys to dimensions plus numeric measures (quantity, amount). It is long and narrow.
  2. Dimensions describe the event: when it happened and what was sold. They are short, wide and full of text you filter and group by.
  3. Add where (store) and who (customer). Every dimension connects directly to the fact table, which is what makes it a star.
  4. A business question becomes a predictable query: filter and group by dimension columns, aggregate fact measures.
  5. 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:

  1. Pick the business process. Sales, shipments, sign-ups. One process, one fact table.
  2. 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.
  3. Identify the dimensions. Everything that describes a row at that grain: date, product, store, customer, promotion.
  4. 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_city next to city. Only one level of history.
$ dbt snapshot --select dim_customer
SCD Type 2: a customer moves from New York to Toronto
source change · C-42 city = Toronto · 2026-03-01 CUSTOMER_KEYCUSTOMER_IDCITY VALID_FROMVALID_TOIS_CURRENT 101C-42New York 2024-05-109999-12-31true 2026-03-01false 205C-42Toronto 2026-03-019999-12-31true FACT_SALES order 9001 · 2026-01-15 · 80 customer_key 101 → New York order 9350 · 2026-04-02 · 120 customer_key 205 → Toronto
  1. Customer C-42 has one version in the dimension, valid "forever" (9999-12-31) and flagged current. (dbt snapshots leave dbt_valid_to NULL instead by default; the idea is the same.)
  2. The source system reports that C-42 moved to Toronto.
  3. Type 2 does not overwrite. It closes the old version: valid_to is set and is_current becomes false.
  4. A new row with a new surrogate key (205) carries the new city from 2026-03-01 onward.
  5. 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_revenue in dim_customer) that go stale and get summed in the wrong place.
  • Not conforming dimensions: dim_customer built 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

Articles and docs

Videos