IntermediateAdvanced PostgreSQL
Theory: What is a Materialized View?
The query
SQL
-- Q: How does a Materialized View differ from a standard View?
-- A: A standard View is just a saved SQL query; it evaluates every time you query it.
-- A Materialized View actually executes the query and caches the result
-- physically on disk. It must be manually refreshed (REFRESH MATERIALIZED VIEW)
-- to get updated data.Note
“Crucial for data warehousing and dashboards where querying raw data is too slow.