Data Warehousing Fundamentals • Materialized Views & AggregationsEasy⏱️ ~3 min
What are Materialized Views?
Definition
A materialized view is physical storage of a query result that is automatically kept in sync with base data. Unlike a regular view (which is just a saved query that runs fresh each time), a materialized view stores actual precomputed results that you can query instantly.
Query Performance Impact
RAW DATA SCAN
30 sec
→
MATERIALIZED VIEW
< 100 ms
💡 Key Takeaways
✓A materialized view stores physical precomputed query results, unlike regular views which are just saved queries that execute fresh each time
✓Solves the problem of repeated expensive aggregations: reading 30 precomputed rows in under 100 ms versus scanning 30 billion raw events in 30 seconds
✓Common use cases include metrics aggregations like daily active users, revenue rollups, and percentile calculations grouped by time or dimensions
✓The fundamental trade is extra storage plus maintenance overhead in exchange for dramatically faster query latency and predictable performance at scale
📌 Examples
1Dashboard showing "DAU by country for last 30 days" queries a 30 row daily summary materialized view instead of scanning billions of raw clickstream events
2Analytics platform maintaining per minute aggregates per user and region, which are 1000 times smaller than raw events but flexible enough to roll up into hourly and daily metrics