Re: Is there a way to avoid “refresh materialized view” generating WAL?

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: 李明 <liming185216(at)126(dot)com>, pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: Is there a way to avoid “refresh materialized view” generating WAL?
Date: 2026-09-08 05:49:19
Message-ID: f72b12d08cde001b33072c6ec12c11cf2cc78f68.camel@cybertec.at
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Tue, 2026-09-08 at 09:50 +0800, 李明 wrote:
> We are using materialized view to speed up complex query,and found that every time
> we execute the command:refresh materialized view mv_name,it generated lots of WAL
> (the size is almost the same as the base table).
>
> I checked the manual but did not find a “unlog” for materialized view.
>
> So, Is there a way to avoid “refresh materialized view” generating WAL?or suppress it?

Currently, that is not possible.

There *were* unlogged materialized views originally, but the sign was flawed (it was
not possible to distinguish between a valid empty materialized view and one that was
empty because of crash recovery), so the feature was deactivated.

There is currently a patch in development to get them back:
https://commitfest.postgresql.org/patch/7167/
The best you can do is to test and review the patch to promote its acceptance.

Yours,
Laurenz Albe

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Cipriani, Ivan 2026-09-08 10:20:20 Seeking Recommendations for PostgreSQL Backup, Restore, and Upgrade Strategy
Previous Message 李明 2026-09-08 05:05:16 Re: Is there a way to avoid “refresh materialized view” generating WAL?