Dimensional Modeling: From Star Schema to OBT

Dimensional modeling is a design technique for data warehouses intended to optimize query performance and usability for business intelligence. While the traditional Kimball Star Schema remains foundational, the rise of modern columnar warehouses like Snowflake and BigQuery has popularized a different pattern: One Big Table (OBT).


1. The Fact Table

The fact table contains the quantitative metrics or "facts" of a business process. Each row represents a specific event or measurement.

1.1 Grain

The grain is the fundamental definition of what a single row in the fact table represents (e.g., "one line item per sales transaction"). Establishing a clear grain is the first step in dimensional design, as it dictates the level of detail available for analysis and ensures consistent aggregation.

1.2 Fact Table Types

1.3 Measures and Keys

Fact tables consist of foreign keys that link to dimension tables and numeric measures. Measures are usually additive (can be summed across all dimensions), semi-additive (can be summed across some dimensions but not others), or non-additive (ratios).


2. Dimension Tables

Dimension tables provide the descriptive context for the facts. They answer the "who, what, where, when, and why" of the business process.

2.1 Surrogate Keys

A surrogate key is an internally generated, unique identifier (usually an integer) used as the primary key for a dimension table. It decouples the data warehouse from changes in the source system's natural keys and enables historical tracking.

2.2 Hierarchies

Dimensions often contain hierarchies, such as a Product dimension with Category and Sub-category levels, or a Date dimension with Year, Quarter, and Month levels.


3. Slowly Changing Dimensions (SCD)

SCD techniques manage how the warehouse handles changes to dimension attributes over time.


4. Schema Geometry: Star Schema vs. OBT

The architecture of your model depends heavily on the underlying database engine and the consumption patterns of your users.

4.1 Star Schema (The Kimball Classic)

In a star schema, the fact table is surrounded by a single layer of dimension tables.

4.2 One Big Table (OBT) / Wide Tables

OBT is a fully denormalized model where every dimension attribute is flattened directly into the fact table.

4.3 Summary Comparison

FeatureStar SchemaOne Big Table (OBT)
NormalizationPartially NormalizedFully Denormalized
Join CostHigh (Shuffle/Broadcast)Zero
Storage UsageLowHigh (Mitigated by Columnar Compression)
MaintenanceEasy (Update Dim Table)Hard (Full Table Re-materialization)
Best EngineTraditional RDBMS (Postgres, Oracle)Columnar Warehouses (Snowflake, BQ)

5. Advanced Patterns

5.1 Junk Dimensions

Consolidates disparate, low-cardinality attributes like flags and status codes into a single table.

5.2 Bridge Tables

Used to handle many-to-many relationships.

5.3 Fact Constellation

Multiple fact tables sharing common dimension tables.


6. Implementation Considerations


See Also: