Re: Unlogged materialized views

From: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
To: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, Adam Brusselback <adambrusselback(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Unlogged materialized views
Date: 2026-09-06 19:23:12
Message-ID: 808fb637-8fe1-4a8f-9588-c44f5de26762@uni-muenster.de
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Zsolt

On 19/08/2026 14:17, Zsolt Parragi wrote:
> I attached a rebased version, otherwise there are no changes.
While doing some research for a new project (REFRESH ALL MATERIALIZED
VIEWS) I found this patch. 0002 and 0003 were not applying due to the
latest changes in meson.build and catversion.h. In order to test the
feature I had to rebase them -- PFA the rebased 0002 and 0003.

A few initial comments:

== The docs do not compile ==

Apparently the new ids in varlistentry, which are currently not used,
are breaking the file.

generating docs ...
ERROR: id attribute missing on <varlistentry> element under /book[(at)id =
'postgres']/part[(at)id = 'reference']/reference[(at)id =
'sql-commands']/refentry[(at)id =
'sql-altermaterializedview']/refsect1/variablelist
no result for postgres-full.xml
make[3]: *** [Makefile:130: html-stamp] Error 10
make[2]: *** [Makefile:8: html] Error 2
make[1]: *** [Makefile:16: html] Error 2
make: *** [GNUmakefile:27: html] Error 2

== tab completion ==

The tab completion does not suggest the new flag:

CREATE UNLOGGED <TAB>
SEQUENCE TABLE

== \d output ==

\d shows an unlogged matview as a normal one

postgres=# CREATE UNLOGGED MATERIALIZED VIEW umv1 AS SELECT 1;
SELECT 1
postgres=# \d umv1
Materialized view "public.umv1"
Column | Type | Collation | Nullable | Default
----------+---------+-----------+----------+---------
?column? | integer | | |

A unlogged table is shown as unlogged, so I believe this should also
apply to matviews:

postgres=# CREATE UNLOGGED TABLE ut1 AS SELECT 1;
SELECT 1
postgres=# \d ut1
Unlogged table "public.ut1"
Column | Type | Collation | Nullable | Default
----------+---------+-----------+----------+---------
?column? | integer | | |

PFA 004 with a few suggestions for the above mentioned issues. I'll take
a closer look at the code in the coming week.

Best, Jim

Attachment Content-Type Size
v3-0001-Add-durable-unlogged-reset-generation-counter.patch text/x-patch 7.1 KB
v3-0002-Replace-pg_class.relispopulated-with-epoch-capabl.patch text/x-patch 25.2 KB
v3-0003-Add-unlogged-materialized-views.patch text/x-patch 47.1 KB
v3-0004-Minor-fixes-to-docs-tab-completion-and-psql-descr.patch text/x-patch 6.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Lakhin 2026-09-06 21:00:00 Re: Internal error codes triggered by regression tests and user queries, take 2
Previous Message Tom Lane 2026-09-06 19:07:58 Re: Internal error codes triggered by regression tests and user queries, take 2