100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace

Star Schema vs Snowflake Schema: What is the Difference?

Compare star and snowflake schemas in data warehousing, with a worked SQL example showing the join trade-off.

mediumQ126 of 228 in Database Est. time: 6 minsLast updated:
Open Code Lab

Expected Interview Answer

A star schema keeps each dimension table fully denormalized in one flat table around a central fact table, while a snowflake schema further normalizes those dimension tables into multiple related sub-tables, trading simpler joins for reduced redundancy.

In a star schema, a dimension like Product holds every attribute โ€” category, subcategory, brand โ€” in one wide table, so querying the fact table needs only a single join per dimension. In a snowflake schema, Product's category and subcategory are split into their own normalized tables linked by foreign keys, so the same query needs multiple chained joins to reach those attributes. Star schemas favor query simplicity and read performance, which suits most BI dashboards, while snowflake schemas favor storage efficiency and easier updates to shared reference data at the cost of more complex joins.

  • Star schema: fewer joins, faster and simpler analytical queries
  • Snowflake schema: less redundant storage for shared attributes
  • Star schema: easier for BI tools and business users to understand
  • Snowflake schema: single source of truth reduces update inconsistency

AI Mentor Explanation

A star schema is like a single wide scoreboard sheet listing each player's team name, coach name, and home ground directly on the same row โ€” one glance gives everything, one join to the fact table. A snowflake schema instead keeps a separate Teams sheet, and that Teams sheet points to a separate Coaches sheet and a separate Grounds sheet, so finding a player's home ground means flipping through three linked sheets. The star trades a bit of duplicated coach and ground info for speed; the snowflake trades that speed for storing each coach and ground exactly once.

Star Schema vs Snowflake Schema for a Product Dimension

Step-by-Step Explanation

  1. Step 1

    Start with the fact table

    Identify the measures (e.g. sales amount) and the foreign keys linking to each dimension.

  2. Step 2

    Choose star for flat dimensions

    Keep each dimension denormalized in one wide table for simple, single-join queries.

  3. Step 3

    Choose snowflake for normalized dimensions

    Split dimensions with shared or hierarchical attributes into linked sub-tables to reduce redundancy.

  4. Step 4

    Evaluate the trade-off

    Weigh query simplicity and read speed (star) against storage efficiency and update consistency (snowflake).

What Interviewer Expects

  • Clear distinction between denormalized (star) and normalized (snowflake) dimensions
  • Understanding of the join-count trade-off between the two designs
  • Awareness that star schemas are generally preferred for BI query performance
  • Ability to give a concrete dimension example, such as Product or Location

Common Mistakes

  • Confusing star/snowflake schema with OLTP normalization rules
  • Claiming snowflake schemas are always better because they reduce redundancy
  • Not mentioning the extra join cost snowflake schemas introduce
  • Forgetting that both designs still center on a fact table with measures

Best Answer (HR Friendly)

โ€œA star schema keeps each dimension, like Product or Location, as one flat table with all its details together, so reports only need one join per dimension. A snowflake schema breaks those dimensions into smaller related tables to avoid repeating data, which saves storage but means more joins to pull the same information together.โ€

Code Example

Star vs snowflake dimension design
-- Star schema: Product dimension is fully flattened
CREATE TABLE Dim_Product_Star (
  product_id INT PRIMARY KEY,
  product_name VARCHAR(100),
  category VARCHAR(50),
  brand VARCHAR(50)
);

-- Snowflake schema: Product references normalized Category and Brand tables
CREATE TABLE Dim_Category (
  category_id INT PRIMARY KEY,
  category_name VARCHAR(50)
);

CREATE TABLE Dim_Brand (
  brand_id INT PRIMARY KEY,
  brand_name VARCHAR(50)
);

CREATE TABLE Dim_Product_Snowflake (
  product_id INT PRIMARY KEY,
  product_name VARCHAR(100),
  category_id INT REFERENCES Dim_Category(category_id),
  brand_id INT REFERENCES Dim_Brand(brand_id)
);

Follow-up Questions

  • Why is a star schema generally faster for BI dashboard queries?
  • When would you deliberately choose a snowflake schema despite the extra joins?
  • What is a galaxy (fact constellation) schema?
  • How do slowly changing dimensions interact with star vs snowflake design?

MCQ Practice

1. In a star schema, dimension tables are typically:

Star schema dimensions are intentionally denormalized so each dimension needs only one join to the fact table.

2. A snowflake schema differs from a star schema mainly by:

Snowflake schemas split dimension attributes into normalized sub-tables linked by foreign keys, unlike the flat star dimensions.

3. Compared to a snowflake schema, a star schema generally offers:

Because star dimensions are flat, analytical queries typically need only one join per dimension, simplifying query design.

Flash Cards

What is a star schema? โ€” A data warehouse design with fully denormalized dimension tables joined directly to a fact table.

What is a snowflake schema? โ€” A star schema variant where dimension tables are further normalized into related sub-tables.

Main trade-off between them? โ€” Star favors query simplicity and speed; snowflake favors storage efficiency and update consistency.

Which needs more joins for the same query? โ€” Snowflake schema, since attributes are spread across chained normalized tables.

1 / 4

Continue Learning