Web Analytics Made Easy - Statcounter

⭐ Star Schema vs ❄️ Snowflake Schema in Data Warehousing

Data Warehousing involves structuring data for fast querying and reporting. Two common dimensional modeling techniques are:

  • Star Schema
  • Snowflake Schema

🔸 What is a Star Schema?

A Star Schema is a denormalized data model where:

  • There is a central fact table
  • Surrounded by dimension tables
  • Dimension tables are not normalized

✅ Key Features:

  • Simple and intuitive
  • Fast query performance
  • Less complex joins

📊 Example:

Fact Table: SalesFact

SaleIDDateKeyProductKeyCustomerKeyStoreKeyRevenue
120230110110011500

Dimension Tables:

  • DateDim: DateKey, FullDate, Month, Quarter, Year
  • ProductDim: ProductKey, ProductName, Category, Brand
  • CustomerDim: CustomerKey, Name, Gender, AgeGroup
  • StoreDim: StoreKey, StoreName, Region

🟨 No normalization inside dimension tables. All attributes live in a flat structure.

🔹 What is a Snowflake Schema?

A Snowflake Schema is a normalized data model where:

  • Dimension tables are split into multiple related tables
  • Reduces data redundancy
  • Requires more joins

✅ Key Features:

  • More normalized
  • Saves storage
  • Complex query structure

📊 Example:

Fact Table: SalesFact
(Same as Star)

Normalized Dimensions:

  • ProductDim: ProductKey, ProductName, SubCategoryKey
  • SubCategoryDim: SubCategoryKey, SubCategoryName, CategoryKey
  • CategoryDim: CategoryKey, CategoryName

🟦 Normalized dimensions form a snowflake-like structure due to multiple levels of hierarchy.

🆚 Key Differences

Feature⭐ Star Schema❄️ Snowflake Schema
StructureDenormalizedNormalized
JoinsFewerMore
Query PerformanceFasterSlower (due to joins)
Data RedundancyHigherLower
Storage EfficiencyLowerHigher
Design ComplexitySimplerMore complex
Use CaseFast queries, dashboardsComplex ETL, large dimensions

💡 When to Use What?

Use CaseRecommended Schema
Dashboards, Ad-hoc reportsStar Schema
Data marts for fast OLAP queriesStar Schema
Central EDW with reusable dimensionsSnowflake Schema
Data model has large dimensions (like Customer, Product Hierarchies)Snowflake Schema

✅ Summary

AspectStar SchemaSnowflake Schema
SimplicityEasy to understand and useMore structured but complex
PerformanceBetter for OLAP/reportingMay slow down due to joins
MaintenanceEasierHarder due to multiple related tables
NormalizationDenormalizedNormalized

🎯 Real Example – Retail

Star Schema:

  • SalesFact — total sales
  • ProductDim — includes product name, brand, category all in one

Snowflake Schema:

  • ProductDim — product-level info
  • BrandDim — connected to Product
  • CategoryDim — connected to Product through subcategory


Discover more from Technology with Vivek Johari

Subscribe to get the latest posts sent to your email.

Leave a Reply

Discover more from Technology with Vivek Johari

Subscribe now to keep reading and get access to the full archive.

Continue reading