Choose a view or a report table
Use an ordinary view when the goal is to name a reusable SELECT. Its result is evaluated from the sources when queried. Use a separate table when the goal is to retain a particular set of calculated rows. Coordinator DB does not provide automatically refreshed materialized views.
CREATE VIEW daily_order_totals AS
SELECT day, count(*) AS orders, sum(amount) AS revenue
FROM orders
GROUP BY day;This view has no stored report rows and needs no refresh command. If the same calculation is copied with CREATE TABLE ... AS SELECT, later source changes do not update that copy. The application must define how and when it is replaced.
For an application-maintained report, specify its freshness requirement, update trigger and verification query before using it. Keep related report changes and an application-owned refresh marker in one transaction if they must agree. A completed statement inside an unfinished transaction is not yet a committed refresh.
Compare a report table with its source calculation using more than total row counts when the values themselves matter. Avoid claiming automatic recovery of refresh schedules after a restart.
See view definitions, table copies, transactions and result comparisons.