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

From: Shaun Thomas <shaun(dot)thomas(at)pgedge(dot)com>
To: 李明 <liming185216(at)126(dot)com>
Cc: 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 14:15:28
Message-ID: CAPEjYekyLC=o7LrUAiAb56oALxaNjfpR+PmoqQpvCk2=4ii0iA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi Ming,

> So, Is there a way to avoid “refresh materialized view” generating WAL?or suppress it?

No, but _technically_ yes. While there's no built-in way to do this
with materialized views, you can use the pg_ivm extension here:

https://github.com/sraoss/pg_ivm

That extension doesn't officially support it either, but once you
create a managed incremental materialized view, you can use an ALTER
TABLE statement to switch the underlying table to UNLOGGED.

SELECT create_immv('mv', 'SELECT ...');
ALTER TABLE mv SET UNLOGGED;

Keep in mind that if you do this, pg_ivm won't know that it should
rebuild the view in the event of a crash, so you'll need to manually
refresh any views managed by the extension.

That's about as close as you're going to get.

Regards,

--
Shaun Thomas
Principal Software Engineer
shaun(dot)thomas(at)pgEdge(dot)com
pgEdge.com

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Siraj G 2026-09-09 04:31:23 fetch all from "<unnamed portal 1>"
Previous Message Cipriani, Ivan 2026-09-08 10:20:20 Seeking Recommendations for PostgreSQL Backup, Restore, and Upgrade Strategy