What is a materialized view?

Answer

A materialized view stores the result of a complex query physically on disk, unlike regular views which execute the query each time. Reading a materialized view is as fast as reading a regular table. The trade-off: the stored data can become stale — it must be refreshed periodically (REFRESH MATERIALIZED VIEW view_name in PostgreSQL). Refresh strategies: on-demand, on a schedule, or automatically on base table change (some RDBMS). Use cases: expensive aggregations for dashboards, pre-joined data for reporting, and reducing load on OLTP tables by pre-computing analytics. PostgreSQL and Oracle support materialized views natively.