🎁 New User? Get 20% off your first purchase with code NEWUSER20 Register Now →
Menu

Categories

Databases Intermediate

What is Materialized View?

A database object that stores the precomputed result of a query, offering faster reads at the cost of periodic refresh.

Unlike regular views that execute their query each time they are accessed, materialized views store query results physically on disk. This dramatically speeds up complex aggregations, joins, and analytical queries. The trade-off is data freshness — materialized views must be refreshed (manually or on schedule) to reflect underlying table changes. PostgreSQL supports REFRESH MATERIALIZED VIEW with a CONCURRENTLY option for zero-downtime refreshes. They are invaluable for dashboards, reports, and read-heavy workloads where slight data staleness is acceptable.

Related Terms

Deadlock
A situation where two or more transactions permanently block each other by each holding locks that the other needs.
EXPLAIN ANALYZE
A PostgreSQL command that shows the execution plan of a query along with actual runtime statistics for performance tuning.
Migration
A version-controlled change to a database schema that can be applied and reversed systematically.
Database Index Types
Different index structures (B-tree, Hash, GIN, GiST, BRIN) optimized for various query patterns and data types.
Soft Delete
A pattern where records are marked as deleted with a flag or timestamp rather than being physically removed from the database.
EXPLAIN Plan
A database command that shows how the query planner will execute a SQL query, revealing join methods, scan types, and estimated costs.
View All Databases Terms →