Skip to main content

Snowflake Schema: A Normalized Data Modeling Approach

The snowflake schema is an extension of the star schema and is widely used in data warehousing and business intelligence. While the star schema is simple and denormalized, the snowflake schema introduces normalization by breaking down dimension tables into smaller, related tables. This results in a structure that resembles a snowflake , hence the name.

Components of a Snowflake Schema

  1. Fact Table:
    • The central table in the snowflake schema, just like in the star schema.
    • Contains quantitative data (measures or metrics) such as sales, revenue, or quantity.
    • Each row in the fact table represents a specific event or transaction.
    • Connected to dimension tables via foreign keys.
    Example:
    • A fact table for a retail store might store sales transactions:
      • Fact_Sales: Txn_ID, Date_ID, Product_ID, Customer_ID, Store_ID, Quantity_Sold, Total_Amount.
  2. Dimension Tables:
    • Surround the fact table like the points of a snowflake.
    • Contain descriptive attributes (context or metadata) related to the facts.
    • Unlike the star schema, dimension tables in a snowflake schema are normalized, meaning they are split into multiple related tables to reduce redundancy.
    Examples:
    • Dim_Date: Date_ID, Date, Month, Quarter, Year, Day_of_Week.
    • Dim_Product: Product_ID, Product_Name, Category_ID, Brand_ID, Price.
    • Dim_Category: Category_ID, Category_Name.
    • Dim_Brand: Brand_ID, Brand_Name.
    • Dim_Customer: Customer_ID, Customer_Name, City_ID, Phone_Number.
    • Dim_City: City_ID, City, State.
    • Dim_Store: Store_ID, Store_Name, City_ID, Manager_Name.

Example: Snowflake Schema for a Retail Store

Star Schema

Snowflake Schema

Fact Table

Fact_Sales

Dimension Tables

  1. Dim_Date:
  2. Dim_Product:
  3. Dim_Category:
  4. Dim_Brand:
  5. Dim_Customer:
  6. Dim_City:
  7. Dim_Store:

How the Snowflake Schema Works

  1. Querying Data:
    • Suppose you want to find the total sales of sarees in Mumbai for January 2025.
    • The query would join the Fact_Sales table with multiple dimension tables using their respective keys.
    • Example SQL Query:
  2. Benefits:
    • Reduced Redundancy: Normalization minimizes data duplication.
    • Improved Data Integrity: Ensures consistency across related tables.
    • Flexibility: Easier to maintain and update.

Advantages of Snowflake Schema

  1. Normalization: Reduces data redundancy and improves storage efficiency.
  2. Data Integrity: Ensures consistency by maintaining relationships between tables.
  3. Scalability: Suitable for complex data models with many relationships.

Disadvantages of Snowflake Schema

  1. Query Performance: More joins can lead to slower query performance compared to the star schema.
  2. Complexity: More tables and joins make the schema harder to design and understand.
  3. Business-Friendliness: Less intuitive for business users compared to the star schema.

Conclusion

The snowflake schema is a powerful data modeling technique that introduces normalization to reduce redundancy and improve data integrity. While it is complex than the star schema, it is well-suited for scenarios requiring detailed and structured data relationships.