Dimensional modeling
Star schema vs snowflake schema
Both organize facts and dimensions. The only real difference is whether you normalize the dimensions — and that single choice changes join counts, query readability and how often your BI tool times out.
Star schema: one hop to every attribute
dim_date dim_customer
\ /
fact_sales
/ \
dim_product dim_storecreate table dim_product (
product_key bigint primary key, -- surrogate key
product_id string, -- natural key
product_name string,
brand_name string, -- denormalized
category_name string, -- denormalized
department_name string -- denormalized
);
create table fact_sales (
sale_id bigint,
date_key int references dim_date,
customer_key bigint references dim_customer,
product_key bigint references dim_product,
store_key bigint references dim_store,
quantity int,
net_amount decimal(18,2)
);Query: revenue by department — one join.
select p.department_name, sum(f.net_amount) as revenue
from fact_sales f
join dim_product p using (product_key)
group by 1;Snowflake schema: dimensions broken into sub-dimensions
create table dim_department (department_key int primary key, department_name string);
create table dim_category (category_key int primary key, category_name string,
department_key int references dim_department);
create table dim_brand (brand_key int primary key, brand_name string);
create table dim_product (
product_key bigint primary key,
product_name string,
brand_key int references dim_brand,
category_key int references dim_category
);Same question — three joins:
select d.department_name, sum(f.net_amount) as revenue
from fact_sales f
join dim_product p using (product_key)
join dim_category c using (category_key)
join dim_department d using (department_key)
group by 1;Multiply that by every dashboard tile and every self-service analyst who has to remember the join path. That's the real cost of snowflaking — human, not just CPU.
Trade-offs at a glance
| Criterion | Star | Snowflake |
|---|---|---|
| Joins per query | 1 per dimension | 2–5 per dimension |
| Storage | Higher (repeated strings) | Lower |
| Query performance | Better on columnar engines | More shuffle |
| BI tool friendliness | Excellent | Needs modeled join paths |
| Update anomalies | Possible — handle with SCD | Fewer by design |
| Onboarding a new analyst | Minutes | Hours |
The decision rule
Default to star. Snowflake a dimension only when you have a specific reason: the sub-dimension is shared across several dimensions, the dimension is so large that duplication actually shows up on the bill, or a governance rule demands one master table. "It feels cleaner" is not a reason — dimensional models optimize for readers, not for third normal form.
Related things interviewers ask right after
- Grain. "What does one row of this fact table represent?" Answer it in one sentence or your model is wrong.
- Surrogate vs natural keys. Surrogate keys are what make SCD Type 2 possible.
- Conformed dimensions. One
dim_customershared by sales, support and billing facts. - Fact types. Transaction, periodic snapshot, accumulating snapshot.
FAQ
- What is the difference between a star schema and a snowflake schema?
- A star schema has one fact table joined directly to denormalized dimension tables — one hop from fact to any attribute. A snowflake schema normalizes those dimensions into sub-dimensions, so reaching an attribute may take several joins. Star favors query simplicity and speed; snowflake favors storage efficiency and normalized consistency.
- Which is faster, star or snowflake?
- Star, in almost every modern warehouse. Fewer joins means less shuffle and better join elimination. On columnar engines like Snowflake, BigQuery and Databricks, the storage savings of normalizing a dimension are usually negligible because repeated string values compress extremely well.
- Is Snowflake (the company) related to the snowflake schema?
- No. The schema is named after its shape — a star whose points branch out further. The company simply borrowed the same imagery. You can and usually should build star schemas on Snowflake the warehouse.
- When should I use a snowflake schema?
- When a dimension is genuinely huge and highly repetitive, when a sub-dimension is reused by several unrelated dimensions, or when a governance rule requires a single normalized master table (product hierarchies, geography, org charts).
- What about One Big Table (OBT)?
- OBT flattens fact and dimensions into a single wide table. It's the fastest to query and the easiest for BI tools, but it duplicates data heavily and makes dimension changes expensive. Many teams model in star and materialize OBT as a final gold-layer table.
- Do I still need dimensional modeling in the cloud?
- Yes. Cheap compute removed the performance pressure but not the modeling pressure — grain, conformed dimensions and surrogate keys are what keep metrics consistent across dashboards.
Ready to start?
7 days free. Then less than a coffee per month.
Practice dimensional modeling — 7 days free- No credit card for the trial
- Cancel anytime
- 300+ exercises
- 14 full courses