Materialized View
A materialized view physically stores query results as a table, refreshed periodically, trading space for query time.
Purpose
To precompute complex query results and speed up aggregation- and join-heavy OLAP queries.
Mechanism
On creation the query runs and results are stored. Refresh modes: ON COMMIT (refresh when base tables commit) and ON DEMAND (manual/scheduled). Query rewrite: the optimizer automatically rewrites base-table queries to read the materialized view.
Use cases
- OLAP query acceleration
- Precomputation strategies
- Query rewriting