# Dimensional Modeling: Star and Snowflake Schemas

> Model analytical data with Kimball-style fact and dimension tables, choose the grain, and decide between star and snowflake schemas. Free notes, key concepts,...

Canonical: https://www.internhack.in/roadmaps/tracks/data-engineer/dimensional-modeling
Last updated: 2026-11-28

Model analytical data with Kimball-style fact and dimension tables, choose the grain, and decide between star and snowflake schemas.

Intermediate · about 8 hours · difficulty 3/5

Learn first: [Normalization and Relational Design](https://www.internhack.in/roadmaps/tracks/data-engineer/normalization)

Dimensional modeling, popularised by Ralph Kimball, is still the most common way to structure warehouse data for analysis. Interviewers love asking you to design one.

### Facts and dimensions

- **Fact tables** store measurable events at a declared grain: one row per order line, per payment, per app session. They hold numeric **measures** (amount, quantity) and foreign keys to dimensions.
- **Dimension tables** describe the who, what, where, when: customer, product, restaurant, date, city.
- **Date dimension**: one row per day with attributes like weekday, month, fiscal quarter (April to March in India) and festival flags such as Diwali sale days.

### The four-step design process

1. Pick the business process (orders, payments, deliveries).
2. Declare the grain (one row per order item).
3. Identify the dimensions.
4. Identify the facts (measures).

### Star vs snowflake

- **Star schema**: each dimension is one wide, denormalized table joined directly to the fact. Simpler and usually faster.
- **Snowflake schema**: dimensions are normalized into sub-tables (product, category, department). Less duplication, more joins.

Most modern teams prefer stars because storage is cheap and analysts want fewer joins.

### Fact table types

- **Transaction** facts: one row per event.
- **Periodic snapshot**: one row per entity per period (account balance per day).
- **Accumulating snapshot**: one row per process instance updated as it moves (order placed, picked, shipped, delivered).

Also know additive, semi-additive (balances) and non-additive (ratios) measures.

### Pitfalls

- Mixing grains in one fact table (order-level and item-level rows together).
- Summing semi-additive measures like balances across time.

You are ready to move on when you can design a star schema for a quick commerce company (Blinkit-style) with a clearly stated grain, three dimensions and the measures, and justify each choice.

## Key concepts

- **Fact and dimension tables**
- **Declaring the grain**
- **Date dimension**
- **Star schema**
- **Snowflake schema**
- **Transaction, periodic and accumulating facts**
- **Additive vs semi-additive measures**
- **Conformed dimensions and bus matrix**
- **Factless facts and junk dimensions**

## Mini project

Design and build a star schema in DuckDB or PostgreSQL for a sample e-commerce dataset: fct_order_items, dim_customer, dim_product, dim_date. Write five business queries against it and document the grain of every table.

## Check yourself

A product belongs to a category which belongs to a department. Show how this looks in a star schema and in a snowflake schema, and argue for one.

## Free resources

- [Kimball dimensional modeling techniques](https://www.kimballgroup.com/data-warehouse-business-intelligence-resources/kimball-techniques/dimensional-modeling-techniques/) (Kimball Group)
- [dbt best practices](https://docs.getdbt.com/best-practices) (dbt Labs)
- [Star schema](https://en.wikipedia.org/wiki/Star_schema) (Wikipedia)

Previous: [Normalization and Relational Design](https://www.internhack.in/roadmaps/tracks/data-engineer/normalization) · Next: [Slowly Changing Dimensions](https://www.internhack.in/roadmaps/tracks/data-engineer/slowly-changing-dimensions)

## More in Data Modeling

- [OLTP vs OLAP Workloads](https://www.internhack.in/roadmaps/tracks/data-engineer/oltp-vs-olap)
- [Normalization and Relational Design](https://www.internhack.in/roadmaps/tracks/data-engineer/normalization)
- [Dimensional Modeling: Star and Snowflake Schemas](https://www.internhack.in/roadmaps/tracks/data-engineer/dimensional-modeling)
- [Slowly Changing Dimensions](https://www.internhack.in/roadmaps/tracks/data-engineer/slowly-changing-dimensions)
- [Modern Modeling Approaches](https://www.internhack.in/roadmaps/tracks/data-engineer/modern-modeling)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Data Engineer Roadmap](https://www.internhack.in/roadmaps/tracks/data-engineer)
