$ normalize dim_product --into category,department
Snowflake Schema
A snowflake schema is a star schema whose dimension tables are normalized: instead of repeating category and department text on every product row, the product dimension points to a category table, which points to a department table. The fact table stays the same; only the dimensions branch out, which gives the diagram its snowflake shape. (The name predates and has nothing to do with the Snowflake cloud warehouse.)
From star to snowflake
$ SELECT department, SUM(amount) ...
Normalizing one dimension, and what it costs a query
- In a star schema, dim_product repeats the category text on every product. Thousands of products, a handful of categories.
- Snowflaking moves categories into their own table. Products now store a cat_key; "Coffee" is written once.
- The hierarchy can keep going: categories point to departments. Each level is a small, clean table.
- The cost: "revenue by department" now walks three joins instead of one, and every BI user has to know the path.
Star vs snowflake
| Star | Snowflake | |
|---|---|---|
| Dimension shape | One wide, denormalized table per dimension | Several normalized tables per dimension |
| Joins per query | Fewer (one hop) | More (one per hierarchy level) |
| Storage | Some repeated text | Less repetition |
| Updating a hierarchy name | Update many rows | Update one row |
| Ease for BI users | Easier | Harder |
| Typical fit | Most analytics on columnar warehouses | Large, shared hierarchies; strict integrity needs |
In columnar warehouses, repeated strings compress very well (dictionary encoding), so the storage saving of snowflaking is usually small. That is why most teams default to a star and snowflake only where it clearly helps.
When snowflaking makes sense
- A hierarchy is shared by several dimensions (a geography table used by both stores and customers).
- A sub-dimension is large or changes often on its own (customer demographics updated monthly while names rarely change). Kimball splits such attributes into a mini-dimension; a secondary table referenced from a dimension is called an outrigger.
- The source is already normalized and a semantic layer hides the joins from users.
Common mistakes
- Snowflaking for “cleanliness” and pushing join complexity onto every dashboard author.
- Forgetting that each extra join is another place for a missing key to silently drop rows (use left joins or “unknown” members).
- Confusing the schema with the Snowflake product: you can build either shape in any warehouse.
See also Star Schema and normalization vs denormalization.
Learning Resources
Books
- The Data Warehouse Toolkit, 3rd Edition: see the sections on snowflaking and outriggers
- Data Warehousing Fundamentals for IT Professionals: chapter on the snowflake schema