$ 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
FACT_SALES date_keyproduct_key store_keyamount DIM_PRODUCT keynamecategory 1LatteCoffee 2EspressoCoffee 3Green teaTea cat_key 112 DIM_CATEGORY keyname 1Coffee2Tea dept 11 DIM_DEPT 1Beverages fact_sales → dim_product → dim_category → dim_dept 3 joins (star: 1)
  1. In a star schema, dim_product repeats the category text on every product. Thousands of products, a handful of categories.
  2. Snowflaking moves categories into their own table. Products now store a cat_key; "Coffee" is written once.
  3. The hierarchy can keep going: categories point to departments. Each level is a small, clean table.
  4. 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

Articles

Videos