Caching Expensive Queries with Materialized Views in PostgreSQL
REFRESH MATERIALIZED VIEW customers_with_revenue;If your data doesn’t change very frequently, you might want to consider using a
TRIGGER
to execute the refresh-statement automatically.