PostgreSQL materialized views 1 question in 2 chapters
PostgreSQL materialized views
1.1 When is a materialized view useful, and how do you manage staleness? Hard 2 min
A materialized view stores a query result so expensive reads can reuse it instead of recalculating everything. The tradeoff is freshness and refresh cost. I would use it for data that tolerates a defined delay, such as reporting, and make that delay visible. Before choosing it, I check whether a better query or index would solve the problem with less operational complexity.
Read the full answer