Database.Middle.What is a star schema? How is it different from a snowflake schema?

A star schema and a snowflake schema are two common ways to design a data warehouse for analytical queries. They define how fact and dimension tables are organized and related.

⭐ Star Schema

Structure:

  • A central fact table with foreign keys to several denormalized dimension tables.
  • Looks like a star: the fact table is at the center, and dimension tables radiate out.
           Time
             |
Product — Fact — Customer
             |
          Location

✅ Characteristics:

  • Dimension tables are flat (denormalized): all attributes in one table.
  • Simple structure, easy to query with JOINs.
  • Preferred for read-heavy analytical workloads.

✅ Pros:

  • Fast query performance (fewer joins)
  • Easy to understand and write SQL for
  • Optimized for OLAP tools (like Power BI, Tableau)

❌ Cons:

  • Data redundancy in dimensions
  • Less normalized = more storage

❄️ Snowflake Schema

Structure:

  • Similar to star schema, but dimension tables are normalized into sub-dimensions.
  • The “arms” of the star have branches — looks like a snowflake.

✅ Characteristics:

  • Dimension tables are normalized: broken into multiple related tables.
  • More complex joins required.

✅ Pros:

  • Saves storage space (removes redundancy)
  • Better data integrity (fewer repeated values)

❌ Cons:

  • Slower queries due to more joins
  • More complex SQL
  • Harder for BI tools and analysts

🧠 Key Differences

FeatureStar SchemaSnowflake Schema
Dimension TablesDenormalized (flat)Normalized (with sub-dimensions)
Query SpeedFasterSlower (more joins)
StorageUses more spaceMore space-efficient
SimplicityEasier to understand and queryMore complex
MaintenanceEasierMore effort (more tables/relationships)
Use CaseOLAP reporting, dashboardsData models with strict normalization

✅ When to Use

Use CaseRecommended Schema
Fast analytics, BI toolsStar Schema
Complex relationships, limited storageSnowflake Schema
Data marts, simple dashboardsStar Schema
Data lakes with many dependenciesSnowflake Schema
This entry was posted in Без рубрики. Bookmark the permalink.