Kimball Dimensional Modeling: Star Schema Techniques

Learn Kimball dimensional modeling with a sales-line example covering grain, surrogate keys, late-arriving dimensions, SCD choices, and star-schema trade-offs.

published: reading time: 17 min read author: Geek Workbench updated: June 17, 2026
Quick Summary

Dimensional modeling starts with a business process and a clear statement of what one fact row represents. This guide follows a sales-line event through dimensions, surrogate keys, late-arriving customer data, and Type 1, Type 2, and Type 3 history choices. Star schemas can make common reporting joins easier to understand, while the best layout and query performance depend on the warehouse engine and workload.

Kimball Dimensional Modeling: The Foundation of Data Warehousing

Dimensional modeling organizes warehouse data around business processes and the questions people ask about them. The first design decision is the grain: what does one row in a fact table represent? That choice constrains the dimensions and measures that belong in the table.

Ralph Kimball’s techniques are widely used, but they are one modeling approach among several. This post starts with a retail sale-line example, then uses it to explain dimensions, star schemas, and history tracking.

Start with grain: one row per sale line

Start by selecting the business process. Here, the process is a product sale recorded by a point-of-sale system. Declare the grain before listing columns:

One row represents one product line on one completed sale event.

A return is a separate event at this grain, with signed quantity and amount values. A daily product total would be a different grain and belongs in a separate periodic snapshot fact table. Do not mix those rows in the same fact table.

For a source event such as order_id=8042, line_number=2, customer_id=C17, product_id=P9, and event_ts=2026-03-12 14:25:00, the order and line identify the sale-line event. The source customer and product IDs are business keys. They identify entities in the source system; they are not the warehouse dimension keys.

In a real feed, use the source’s stable line-event identifier when available. If it has none, define a composite key that distinguishes corrections and returns as well as order lines.

With the grain fixed, choose dimensions that describe that event: customer, product, store, and the event date/time. Measures must also be true for one sale line, such as quantity, unit price, and extended amount. Order-level shipping cost, for example, should not be repeated on every line unless the model includes an explicit allocation rule.

Kimball’s grain guidance treats this declaration as the contract for selecting dimensions and facts. The four-step design process puts business process and grain before dimensions and facts.

The SQL examples use ANSI-style syntax. A :name token is a named parameter placeholder; adapt parameter binding and the maximum-timestamp sentinel to your warehouse.

Resolve dimension surrogate keys at event time

Dimension foreign keys in the fact use warehouse-generated surrogate keys. Keep source event IDs for lineage when needed. In a Type 2 customer dimension, each version has its own customer_sk; several rows can share one customer_natural_key.

The SQL below uses named parameters such as :customer_natural_key as placeholders. Resolve the dimension version whose effective interval contains the sale timestamp. The half-open interval includes valid_from and excludes valid_to, so a change exactly at a boundary matches one version. These columns represent when the attributes were true in the business, not when the warehouse received them. Keep intervals for the same business key from overlapping; enforce that in the load or with database constraints where supported.

SELECT customer_sk
FROM dim_customer
WHERE customer_natural_key = :customer_natural_key
  AND valid_from <= :event_ts
  AND :event_ts < valid_to;

Use that key when loading the sale line. The fact keeps the event-time version even if the customer’s current region or segment changes later.

INSERT INTO fact_sales (
    source_event_id, order_number, line_number, customer_sk, product_sk,
    store_sk, event_date_sk, event_ts, quantity_sold, extended_amount
)
VALUES (
    :source_event_id, :order_id, :line_number, :customer_sk, :product_sk,
    :store_sk, :event_date_sk, :event_ts, :quantity, :extended_amount
);

Handle a customer dimension that arrives late

Sometimes the sale event arrives before the descriptive customer record. If the source customer key is known, create an inferred dimension member with that business key, a new surrogate key, and generic values for attributes that have not arrived. The fact can then load with a valid foreign key rather than being dropped or attached to an unrelated customer.

For the example sale line, that means creating an inferred member for C17 whose effective interval includes 2026-03-12 14:25:00, then loading the sale with that member’s customer_sk.

When the customer record arrives, fill in the inferred row if the supplied data describes the same effective version. If the source supplies retroactive Type 2 history, add the effective-dated versions and restate affected facts so each sale points to the customer version that was valid at event_ts. Keep the restatement in a controlled, repeatable load; do not silently overwrite history when users rely on historical reports. See Kimball’s guidance on late-arriving dimensions.

To report each sale under the customer’s region in effect at the sale time, group by the version selected for that event:

SELECT
    c.region,
    SUM(f.extended_amount) AS revenue
FROM fact_sales AS f
JOIN dim_customer AS c
  ON c.customer_sk = f.customer_sk
WHERE f.event_ts >= :period_start
  AND f.event_ts < :period_end
GROUP BY c.region;

This query uses the surrogate key resolved during the event-time lookup. If a retroactive dimension correction changes the effective intervals, restate the affected customer_sk values before treating the query as historically correct.

Fact and dimension tables

Every dimensional model centers on two types of tables: facts and dimensions.

A fact table stores measurements produced by a business process. Sales amounts, order counts, page views, and sensor readings are common examples. Some measures are additive across dimensions; others are semi-additive or non-additive. The declared grain determines what each measure means.

A dimension table stores the context around those facts. Who placed the order? What product was purchased? When did the transaction occur? Dimensions are the “who, what, when, where, why” that give facts their meaning.

flowchart LR
    subgraph Fact[Fact Table<br/>fact_sales]
        F1[source_event_id]
        F2[product_sk]
        F3[customer_sk]
        F4[event_date_sk]
        F5[quantity_sold]
        F6[extended_amount]
    end
    subgraph DimProduct[dim_product]
        D1[product_sk]
        D2[product_name]
        D3[category]
        D4[brand]
    end
    subgraph DimCustomer[dim_customer]
        C1[customer_sk]
        C2[customer_name]
        C3[region]
        C4[segment]
    end
    subgraph DimDate[dim_date]
        T1[event_date_sk]
        T2[year]
        T3[month]
        T4[day_of_week]
    end
    Fact -->|product_sk| DimProduct
    Fact -->|customer_sk| DimCustomer
    Fact -->|event_date_sk| DimDate

This structure is called a star schema because dimension tables connect directly to the central fact table.

-- Illustrative schema; one row per sale line as declared above.
CREATE TABLE fact_sales (
    source_event_id VARCHAR(80) PRIMARY KEY,
    order_number VARCHAR(40),
    line_number INT,
    product_sk BIGINT,
    customer_sk BIGINT,
    store_sk BIGINT,
    event_date_sk INT,
    event_ts TIMESTAMP,
    quantity_sold INT,
    unit_price DECIMAL(10,2),
    extended_amount DECIMAL(12,2),
    discount_amount DECIMAL(10,2)
);

-- Dimension table: product information
CREATE TABLE dim_product (
    product_sk BIGINT PRIMARY KEY,
    product_natural_key VARCHAR(80),
    product_name VARCHAR(200),
    category VARCHAR(100),
    subcategory VARCHAR(100),
    brand VARCHAR(100),
    unit_cost DECIMAL(10,2),
    is_active BOOLEAN
);

-- Type 2 customer rows share a business key but have distinct surrogate keys.
CREATE TABLE dim_customer (
    customer_sk BIGINT PRIMARY KEY,
    customer_natural_key VARCHAR(80) NOT NULL,
    customer_name VARCHAR(200),
    region VARCHAR(100),
    segment VARCHAR(100),
    valid_from TIMESTAMP NOT NULL,
    valid_to TIMESTAMP NOT NULL,
    is_current BOOLEAN NOT NULL
);

The star schema

In a star schema, each dimension joins directly to the fact table. This often gives report authors a straightforward path between business measures and descriptive attributes.

For example, the sale-line table can be grouped by product category and event date. The query uses surrogate-key joins, while the source business keys stay in the dimension tables for loading and lineage.

SELECT
    dp.category,
    dd.year,
    dd.month,
    SUM(fs.extended_amount) AS total_revenue,
    COUNT(DISTINCT dc.customer_natural_key) AS unique_customers
FROM fact_sales fs
JOIN dim_product dp ON fs.product_sk = dp.product_sk
JOIN dim_customer dc ON fs.customer_sk = dc.customer_sk
JOIN dim_date dd ON fs.event_date_sk = dd.event_date_sk
WHERE dd.year = 2025
GROUP BY dp.category, dd.year, dd.month
ORDER BY total_revenue DESC;

The shape alone does not guarantee a faster query. Performance depends on the warehouse engine, table size, sort or distribution strategy, statistics, filters, caching, and the actual query. Compare representative queries with the warehouse’s plan and runtime metrics before choosing between a star, a snowflake, or another layout.

Snowflake schema

The Snowflake schema normalizes dimension tables into hierarchical structures. A product dimension might split into product, category, and subcategory tables.

-- Snowflake: category separated into its own table
CREATE TABLE dim_category (
    category_sk BIGINT PRIMARY KEY,
    category_natural_key VARCHAR(80),
    category_name VARCHAR(100),
    department VARCHAR(100)
);

CREATE TABLE dim_product (
    product_sk BIGINT PRIMARY KEY,
    product_natural_key VARCHAR(80),
    product_name VARCHAR(200),
    category_sk BIGINT REFERENCES dim_category(category_sk),
    brand VARCHAR(100)
);

Snowflaking can reduce repeated dimension attributes, at the cost of more joins and a model that report authors must understand. Whether that trade-off helps depends on storage, query patterns, and the capabilities of the warehouse engine.

Neither shape is a universal default. A star may suit self-service reporting across common dimensions; a snowflake may suit a hierarchy with shared attributes or a workload where normalized dimension storage matters. Measure the workload and consider how the chosen BI tools expose the model.

Star schema trade-offs

Question Star schema Snowflake schema Data Vault One Big Table
Join path Dimensions often join directly to facts. A hierarchy can require joins between dimension tables. Queries commonly resolve hubs, links, and satellites. A pre-flattened row may avoid joins but repeat attributes.
Storage Repeats some descriptive attributes. Normalizes shared attributes into related tables. Stores history and relationships across multiple structures. Can repeat substantial dimension data.
Load and change handling Requires dimension-key lookup and any selected SCD policy. Also maintains normalized hierarchy relationships. Often needs automated hash-key and history-loading rules. Must handle repeated attribute updates consistently.
Fit Useful when direct dimension-to-fact paths match reporting needs. Useful when normalized hierarchies or shared attributes matter. Useful when auditability and source history drive the design. Useful for a bounded set of stable, predictable queries.

These are design tendencies, not performance rankings. Query plans, data volume, update patterns, and BI tooling can change the result for a particular warehouse.

A conformed dimension is shared by multiple fact tables with consistent definitions and keys. A date dimension is a common example; a warehouse can use it to compare measures from different business processes on the same calendar.

When fact tables use the same conformed dimensions, reports can compare their measures by shared attributes. For example, sales and inventory facts can be analyzed by the same product dimension if both models use its agreed definitions and keys.

Building conformed dimensions requires coordination. Teams need to agree on what a “customer” means, how it is keyed, and which attributes belong in the shared dimension. Without that agreement, reports that combine fact tables may group the same entity differently.

Slowly changing dimensions

Real-world data changes. Customer addresses change, products get rebranded, employees transfer departments. Dimension tables must track these changes in a way that preserves analytical value.

Slowly changing dimension (SCD) techniques describe how the warehouse handles changes to descriptive attributes. Choose a policy per attribute based on reporting and audit needs.

Type 1: overwrite

The old value disappears and the new value replaces it. In a dimension that also uses Type 2 for other attributes, update this Type 1 attribute across all versions for the business key so historical rows do not retain a value that the policy says to overwrite.

This approach is simple but destroys history. If you overwrite a customer’s region, you can no longer analyze historical sales by the old region.

-- Type 1: Simple update, no history
UPDATE dim_customer
SET region = 'Northeast'
WHERE customer_natural_key = 'C17';

Type 2: add a new row

When a tracked attribute changes and reports must preserve both versions, add a dimension row with a new surrogate key and an effective interval. Keep the stable business key in a separate column so the versions can be found as one customer.

-- Apply both statements in one transaction. :change_ts is the effective boundary.
BEGIN;
UPDATE dim_customer
SET valid_to = :change_ts, is_current = FALSE
WHERE customer_natural_key = 'C17'
  AND is_current = TRUE;

INSERT INTO dim_customer (
    customer_sk, customer_natural_key, customer_name, region, segment,
    valid_from, valid_to, is_current
) VALUES (
    :new_customer_sk, 'C17', 'Jordan Lee', 'Northeast', 'Retail',
    :change_ts, TIMESTAMP '9999-12-31 00:00:00', TRUE
);
COMMIT;

The surrogate key identifies one version; customer_natural_key identifies the source customer across versions. Use half-open intervals (valid_from <= event_ts AND event_ts < valid_to) for as-of lookups. Type 2 retains history for attributes you track from the point the warehouse has reliable data; it does not reconstruct missing source history by itself. See Kimball’s Type 2 technique.

Type 3: add a prior-value attribute

Keep both old and new values as separate columns in the same row.

ALTER TABLE dim_customer ADD COLUMN previous_region VARCHAR(100);
UPDATE dim_customer SET previous_region = 'Southeast' WHERE customer_natural_key = 'C17';
UPDATE dim_customer SET region = 'Northeast' WHERE customer_natural_key = 'C17';

Type 3 lets you compare the current value with the prior value stored in the row. It retains only the number of versions represented by those columns; older history requires another approach.

Choose a history policy per attribute

There is no single SCD type that fits every column. Decide whether a correction changes the accepted truth, whether reports need the old value, and how often the attribute changes.

Need Possible policy What to check
Correct a bad value or intentionally keep only the current value Type 1 overwrite Past reports grouped by this attribute will change. Keep a separate audit log if the correction itself must be traceable.
Report what was true when a sale or other event occurred Type 2 version Resolve the surrogate key using the event timestamp and effective interval; define how late and retroactive changes restate facts.
Meet an audit or regulated-history requirement Type 2 plus an explicit audit and retention design Type 2 is not, by itself, an immutable audit trail or proof of regulatory compliance. Preserve source, load, approval, and correction metadata required by the policy.
Track a rapidly changing state such as order status Model status changes as events, a periodic snapshot, or another fit-for-purpose structure Type 2 can create many dimension versions. Choose based on the questions users need to answer and expected change volume.
Compare only the current value with the immediately previous value Type 3 columns This retains only the limited history represented by those columns.

Degenerate dimensions

Sometimes the fact table contains attributes that are not foreign keys to dimension tables. An order number, invoice number, or transaction ID might live directly in the fact table.

These degenerate dimensions can have high cardinality. They are useful for filtering or grouping but do not need their own dimension table when they carry no additional descriptive attributes.

CREATE TABLE fact_sales (
    source_event_id VARCHAR(80) PRIMARY KEY,
    order_number VARCHAR(20),  -- Degenerate dimension
    product_sk BIGINT,
    event_date_sk INT,
    quantity_sold INT,
    extended_amount DECIMAL(12,2)
);

Order numbers are useful for tracking all items in a specific order without requiring a separate dimension table.

Fact table types

Transaction fact tables

One row per discrete event, such as a sale line, click, or payment. The declared grain states exactly which event the row records. A sale and a later return can be separate rows, represented according to the source and reporting conventions.

Load complexity depends on source quality, dimension-key resolution, and the history policy for each dimension.

The load resolves source business keys to dimension surrogate keys before inserting the fact. If a sale happened on March 1 but arrives on March 3, its event date key still represents March 1; the load date is separate metadata.

Common queries aggregate sales by month, order value by region, or clicks by source. Additive measures such as quantity and line revenue can be summed across compatible dimensions; ratios and distinct counts should be calculated at the requested reporting grain.

Table size follows event volume and retention. If common queries filter by event date and the warehouse supports partition pruning, date-based partitions may help; confirm the effect with query plans and maintenance costs before choosing a partition strategy.

Periodic snapshot fact tables

One row per dimension combination per period, such as monthly sales by product or daily inventory. A snapshot stores state at a chosen point in time, which can avoid recalculating it from every earlier transaction. A monthly sales row might hold total quantity, total revenue, and average price for one product and region. It trades transaction-level detail for a compact view at that interval.

Choose snapshot frequency based on how often the business needs a new state and how much source detail should be retained. Daily inventory, monthly revenue, and quarterly planning are examples; the useful interval depends on the decisions the reports support.

An aggregate snapshot cannot answer questions below its interval. A monthly sales snapshot cannot show which day within the month performed best. Keep a transaction fact as well when users need that detail; the two tables answer different questions.

Snapshot row counts depend on the dimension combinations present in each interval. Estimate them from actual cardinalities and the retention period, then choose partitioning and archival policies based on engine behavior and access patterns.

Accumulating snapshot fact tables

One row per lifecycle instance, such as an order. Update that row at each milestone from creation through fulfillment and delivery.

CREATE TABLE fact_order_progress (
    order_id BIGINT PRIMARY KEY,
    customer_sk BIGINT,
    product_sk BIGINT,
    order_date_sk INT,
    ship_date_sk INT,
    delivery_date_sk INT,
    days_to_ship INT,
    days_to_deliver INT
);

Accumulating snapshots support lifecycle analysis. Late-arriving milestones need a defined update and correction process.

Junk dimensions

When a fact has many small, unrelated flags, a junk dimension can store their combinations instead of keeping separate columns such as promo_ind, gift_wrap_ind, and loyalty_ind.

CREATE TABLE dim_flags (
    flag_key INT PRIMARY KEY,
    promo_ind CHAR(1),
    gift_wrap_ind CHAR(1),
    loyalty_ind CHAR(1)
);

The fact table stores one flag_key, and the dimension maps it to the flag combination. This can reduce repeated flag columns in the fact table, though the extra lookup is useful only when it fits the model and query patterns.

Bridge tables for hierarchies

When a dimension has a parent-child hierarchy (org chart, product category tree), a bridge table handles the many-to-many relationships.

CREATE TABLE dim_product_category (
    category_id INT PRIMARY KEY,
    category_name VARCHAR(100),
    parent_category_id INT REFERENCES dim_product_category(category_id)
);

-- Bridge table for products in multiple categories
CREATE TABLE bridge_product_category (
    product_sk BIGINT,
    category_id INT,
    PRIMARY KEY (product_sk, category_id)
);

The bridge supports queries across product-category relationships. Define how measures should be allocated when a product belongs to multiple categories, or totals can be double-counted.

Kimball dimensional modeling anti-patterns

Normalizing dimensions without checking the workload. Splitting category and subcategory into separate tables may reduce repeated attributes, but it adds joins and another relationship for report authors. Compare storage, query plans, and BI-tool behavior before choosing that structure.

Conformed dimension drift. Two teams build date dimensions with different definitions or keys. A report that combines their facts then needs translation logic and can produce inconsistent totals. Agree on shared dimension meaning and keys before many fact tables depend on them.

Type 2 growth on high-change attributes. Applying SCD Type 2 to a rapidly changing value such as order status can create many versions. Decide whether users need event history, periodic state, or an effective-dated dimension before choosing the representation.

Bridge table overuse. Adding bridge tables for every many-to-many relationship, including ones that rarely get queried. Bridge tables complicate joins for all analysts even when only a few use cases actually need hierarchy traversal. Only add bridges when the hierarchy query is frequent and meaningful.

Kimball dimensional modeling quick recap

  • Fact tables store measurable events; dimension tables store the context (who, what, when, where, why).
  • A star schema provides direct dimension-to-fact joins; test its performance on the target engine and workload.
  • Conformed dimensions enable drill-across reporting across multiple fact tables.
  • SCD Type 1 overwrites selected values; Type 2 keeps effective-dated versions; Type 3 stores a limited prior value.
  • Choose a star or snowflake shape based on query patterns, engine behavior, and how teams use the model.
  • Bridge tables handle hierarchies; junk dimensions consolidate low-cardinality flags.
  • Type 2 can grow quickly for high-change attributes; compare it with event history or snapshots when those better match the questions.

For related reading on data modeling approaches, see the Data Vault and One Big Table patterns that offer alternative approaches to the same problem space.

Category

Related Posts

Data Vault Modeling: Hubs, Links, Satellites, and Trade-offs

Learn how Data Vault hubs, links, and satellites organize integrated warehouse history, where deterministic hash keys fit, and when a simpler dimensional model is a better choice.

#data-engineering #data-modeling #data-vault

One Big Table: The Denormalized Approach to Data Modeling

Learn how One Big Table architecture simplifies data pipelines by combining all attributes into single wide denormalized tables.

#data-engineering #data-modeling #one-big-table

Slowly Changing Dimensions: History in Data Warehouses

Master Slowly Changing Dimension techniques including Type 1, Type 2, and Type 3 for maintaining historical accuracy in data warehouses.

#data-engineering #data-modeling #slowly-changing-dimensions