Re: Is there a way to avoid “refresh materialized view” generating WAL?
Re: Is there a way to avoid “refresh materialized view” generating WAL?
От:
Shaun Thomas <shaun.thomas@pgedge.com>
Дата:
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.thomas@pgEdge.com
pgEdge.com