skip to content

Star vs Snowflake Schema

A star keeps dimensions wide and denormalized; a snowflake normalizes them into sub-tables. Interviewers ask you to compare the two to see whether you weigh join cost and analyst usability against storage and maintenance.

on this pageshow

questions

6

What is the difference between a star schema and a snowflake schema?

level: juniorimportance: must knowfreq 85%

answer

  1. how many tables per dimension?
  2. count the joins to a department name
  3. one wide table versus a branching chain
  4. the fact table is the same either way
  5. denormalized dimension versus normalized hierarchy

basics

~20 s

A star schema keeps each dimension as one wide, denormalized table joined directly to the fact table. A snowflake splits those dimensions into normalized hierarchy sub-tables, so reaching an attribute costs extra joins. The fact table is identical in both.

solid answer

~40 s

Both are dimensional models: a central fact table of measurements surrounded by descriptive dimension tables. The difference is only the **shape of the dimensions**. In a star, `dim_product` carries SKU, product name, brand, category and department as columns on one row, and the fact joins straight to it — one hop to any attribute. In a snowflake, those levels are normalized out into `dim_brand`, `dim_category`, `dim_department`, each holding a key to the next level up, so a query grouping by department joins three or four tables instead of one. The fact table, its grain and its foreign keys do not change either way. The names come from the diagram: a fact ringed by single dimensions looks like a star, while branching hierarchy arms look like a snowflake.

go deeper

for a junior

Be able to define both shapes in two sentences and draw them: one wide dimension table per dimension versus hierarchy levels split into their own tables. Know that the extra joins are the visible difference.

for a middle

Explain that only the dimension side changes — the fact table, its grain and its foreign keys are identical — and quantify why the storage the snowflake saves is small next to fact-table volume.

for a senior

Be ready to justify which shape you would publish to analysts and why, and to describe a model that is normalized in the load layer but presented flat to consumers.

for a principal

Expect to argue the shape as a platform-wide default rather than a per-mart taste, and to explain what inconsistency between marts costs an analytics organization.

## The vocabulary first A dimensional model has two kinds of table. A **fact table** stores measurements at a declared grain — one row per order line, per day-and-account balance, per shipment. A **dimension table** stores the descriptive context you filter, group and label by — the product, the customer, the store, the date. Every fact row carries a foreign key to each dimension it is described by. Star versus snowflake is a question about **the shape of the dimensions only**. It says nothing about the fact table. ## The star shape In a star schema each dimension is exactly one table, deliberately denormalized so that every descriptive attribute a user might want lives as a column on the same row: ```sql CREATE TABLE dim_product ( product_key BIGINT PRIMARY KEY, sku VARCHAR(40), product_name VARCHAR(200), brand_name VARCHAR(100), category_name VARCHAR(100), department_name VARCHAR(100) ); ``` The brand, category and department labels repeat across thousands of product rows, and that repetition is intentional. A query for revenue by department joins one table: ```sql SELECT d.department_name, SUM(f.net_amount) FROM fact_sales f JOIN dim_product d ON d.product_key = f.product_key GROUP BY d.department_name; ``` Drawn on a whiteboard, the fact table sits in the middle with a ring of single dimension tables around it — hence "star". ## The snowflake shape A snowflake normalizes the hierarchy out of the dimension into one table per level, each pointing at its parent: ```sql dim_product(product_key, sku, product_name, brand_key) dim_brand(brand_key, brand_name, category_key) dim_category(category_key, category_name, department_key) dim_department(department_key, department_name) ``` The same department query now traverses the chain: ```sql SELECT dep.department_name, SUM(f.net_amount) FROM fact_sales f JOIN dim_product p ON p.product_key = f.product_key JOIN dim_brand b ON b.brand_key = p.brand_key JOIN dim_category c ON c.category_key = b.category_key JOIN dim_department dep ON dep.department_key = c.department_key GROUP BY dep.department_name; ``` Each label is now stored once. The branching arms off the central fact table are what the "snowflake" name describes. ## What does not change This is the part candidates most often get wrong. Snowflaking a dimension does **not** change the fact table's grain, its row count, its measures, or the set of foreign keys it carries. `fact_sales` still holds `product_key` in both designs; the fact still joins to `dim_product` and only to `dim_product`. All that changes is the path from a fact row to a high-level label — one join in a star, several in a snowflake. It is also not a physical storage decision: both shapes are ordinary tables, and the choice is independent of how the engine stores or compresses them. ## The trade-off in one paragraph The star buys query simplicity and a single obvious join path with duplicated label text; the snowflake buys single-place storage of each label with more tables, more join paths and more ways for a hand-written query to go wrong. Because dimensions are typically orders of magnitude smaller than facts — a few hundred thousand product rows against billions of sales rows — the storage the snowflake saves is usually negligible, which is why the star is the industry default for consumer-facing marts. ## Why the redundancy is acceptable here In a transactional schema, repeating a label on every row invites contradictory data because many concurrent writers can update one copy and not another. A warehouse dimension is different: it is rebuilt or merged by a controlled batch load, users only read it, and the load process is the single writer that keeps every copy consistent. The reason to normalize an operational table therefore does not transfer automatically to a mart — the analytics model is optimized for reads, and it pays for that with duplication the loader manages. ## What an interviewer is listening for A crisp definition, the fact-table-unchanged point, and the naming of the axes being traded — join count and analyst usability against storage and label maintenance. Answers that simply assert "snowflake is more normalized, so it is better designed" miss that normalization is a means, not a goal, in an analytics model.

  • Does snowflaking a dimension change anything about the fact table?
    No. The grain, the measures, the row count and the foreign keys are identical. The fact still carries one product key and joins to the product dimension; only the path from that dimension up to higher-level labels gains tables. That is why you can snowflake or flatten a dimension without rewriting the fact load.
  • Can one model contain both star-shaped and snowflaked dimensions?
    Yes, and that is common in practice. Most dimensions are kept wide, while one or two — often a large reference hierarchy maintained by an upstream master-data system — stay normalized. The house rule is usually that consumer-facing dimensions are flat and any normalization lives in the layer beneath.
  • Where do the names star and snowflake come from?
    From the entity diagram. A fact table surrounded by single dimension tables radiates like a star's points. When hierarchy levels are split into their own tables, those points branch again into arms that resemble a snowflake crystal. The names describe the picture, not any property of the storage engine.

A star dimension is a single index card with everything about the product written on it; a snowflake is a card that points to a brand card, which points to a category card, which points to a department card.

saying these in an interview costs you the question

  • Says a snowflake schema is a star with extra fact tables
  • Claims snowflaking changes the fact table's grain or row count
  • Thinks the fact table gains a key per hierarchy level
  • Treats star versus snowflake as a physical storage or compression choice
  • Argues snowflaking is always better because it is more normalized

context

open as a page

Why is a star schema the default choice over a snowflake for analyst-facing marts?

level: middleimportance: must knowfreq 70%

basics

~20 s

Dimensions are tiny next to fact tables, so normalizing them saves almost no storage while adding joins to every query and forcing analysts to know the hierarchy. A star trades cheap duplication for one obvious join path.

open as a page

When is snowflaking a dimension into normalized sub-tables actually the right call?

level: middleimportance: should knowfreq 50%

basics

~20 s

Snowflake when a hierarchy level is huge and repeated, is mastered and governed upstream as its own reference entity, or changes on a different cadence than the dimension. Even then, most teams normalize the load layer and publish a flattened dimension.

open as a page

A snowflaked product dimension spans seven tables and every dashboard joins all of them — how would you restructure it?

level: seniorimportance: should knowfreq 45%

basics

~20 s

Flatten it into one wide dimension at the product grain, keeping the normalized tables as the load and reference layer. Verify each level contributes at most one row per product, then publish the flat table and reconcile totals against the old joins before cutting dashboards over.

open as a page

How do you set a house standard for dimension denormalization — star or snowflake — across dozens of marts?

level: principalimportance: should knowfreq 32%

basics

~20 s

Make flat star dimensions the published default, allow normalization only in the layer beneath, and write the exceptions as testable criteria rather than taste. Enforce through review and automated model tests, and measure adoption instead of assuming compliance.

open as a page

What is a fact constellation (galaxy) schema, and when does a model become one?

level: middleimportance: nice to knowfreq 38%

basics

~20 s

A fact constellation, also called a galaxy schema, is several fact tables sharing the same dimension tables. Models become one as soon as a second business process is added — sales and inventory both pointing at the same date and product dimensions.

open as a page