Reputation: 57
...let's say the underlying data of a materialized view is 1 million rows. Then, a single row in that data changes. How does Postgres 9.5 process that? I.e., does it rebuild the materialized view from scratch, or only the parts that are affected by the changed row?
Upvotes: 1
Views: 735
Reputation:
REFRESH MATERIALIZED VIEW completely replaces the contents of a materialized view. The old contents are discarded.
(Emphasis mine)
It is essentially the same as:
delete from mview;
insert into mview
select ...
Where the select
is the stored query.
Upvotes: 4