6 min read
Data Modelling – Star and Snowflake Pattern
Understanding star and snowflake schema patterns in data modeling
What is Data Modeling?
Data modeling is how you organize your data tables. Good models make analysis easier.
Star Schema
The most common pattern. Looks like a star!
Structure
- Fact Table (center) - Contains numbers (sales, quantity)
- Dimension Tables (around) - Contains descriptions (product name, date)
Example
[Date]
|
[Product]--[Sales Fact]--[Customer]
|
[Store]
Benefits
- Simple to understand
- Fast queries
- Easy to use in Tableau
Snowflake Schema
Like star, but dimensions have sub-dimensions.
Example
[Category]--[Product]--[Sales Fact]--[Customer]--[City]--[Country]
Benefits
- Less data duplication
- More organized
- Better for complex data
Star vs Snowflake
| Feature | Star | Snowflake |
|---|---|---|
| Complexity | Simple | Complex |
| Query Speed | Faster | Slower |
| Storage | More space | Less space |
| Best For | Tableau | Data warehouses |
In Tableau
Tableau prefers Star Schema because:
- Easier to create relationships
- Better performance
- Simpler to understand
Creating Relationships
- Drag first table to canvas
- Drag related table
- Tableau auto-detects relationship
- Adjust join fields if needed
Tips
- Keep fact table in center
- Link dimensions to fact table
- Avoid too many joins
- Use extracts for speed
Summary
Star schema is best for Tableau. One fact table in center, dimension tables around it. Simple and fast!