data-infra
Glossary ↗Materialized View
A materialized view is a database object that stores the precomputed result of a query on disk, rather than recalculating it every time you read it. A normal (virtual) view runs its underlying query fresh on each access; a materialized view saves the answer so subsequent reads are fast — you're trading storage and freshness for query speed. For SaaS builders, materialized views are a pragmatic way to speed up expensive dashboards, aggregations, and reports without adding a whole caching layer. Instead of summing millions of rows on every page load, you query a small precomputed table. The catch is staleness: the stored result only reflects the data as of the last refresh. You must decide how to refresh — on a schedule, on demand, or incrementally as base data changes. Postgres supports REFRESH MATERIALIZED VIEW (with a CONCURRENTLY option to avoid locking reads); warehouses like Snowflake and BigQuery offer auto-refreshing variants. Rule of thumb: reach for one when reads vastly outnumber writes and users tolerate slightly delayed numbers.
Related terms