From: | Erik Wienhold <ewie(at)ewie(dot)name> |
---|---|
To: | Said Assemlal <sassemlal(at)neurorx(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: CREATE OR REPLACE MATERIALIZED VIEW |
Date: | 2024-10-31 00:22:17 |
Message-ID: | d4bf3ccf-5c2b-448d-ad16-59dd6fbe2a2e@ewie.name |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2024-09-05 22:33 +0200, Erik Wienhold wrote:
> On 2024-07-27 02:45 +0200, Erik Wienhold wrote:
> > On 2024-07-12 16:49 +0200, Said Assemlal wrote:
> > > > My initial idea, while writing the patch, was that one could replace the
> > > > matview without populating it and then run the concurrent refresh, like
> > > > this:
> > > >
> > > > CREATE OR REPLACE MATERIALIZED VIEW foo AS ... WITH NO DATA;
> > > > REFRESH MATERIALIZED VIEW CONCURRENTLY foo;
> > > >
> > > > But that won't work because concurrent refresh requires an already
> > > > populated matview.
> > > >
> > > > Right now the patch either populates the replaced matview or leaves it
> > > > in an unscannable state. Technically, it's also possible to skip the
> > > > refresh and leave the old data in place, perhaps by specifying
> > > > WITH *OLD* DATA. New columns would just be null. Of course you can't
> > > > tell if you got stale data without knowing how the matview was replaced.
> > > > Thoughts?
> > >
> > > I believe the expectation is to get materialized views updated whenever it
> > > gets replaced so likely to confuse users ?
> >
> > I agree, that could be confusing -- unless it's well documented. The
> > attached 0003 implements WITH OLD DATA and states in the docs that this
> > is intended to be used before a concurrent refresh.
> >
> > Patch 0001 now covers all matview cases in psql's tab completion. I
> > missed some of them with v1.
>
> Here's a rebased version due to conflicts with f683d3a4ca and
> 1e35951e71. No other changes since v2.
rebased
--
Erik
Attachment | Content-Type | Size |
---|---|---|
v4-0001-Add-CREATE-OR-REPLACE-MATERIALIZED-VIEW.patch | text/x-diff | 31.8 KB |
v4-0002-Deprecate-CREATE-MATERIALIZED-VIEW-IF-NOT-EXISTS.patch | text/x-diff | 11.0 KB |
v4-0003-Replace-matview-WITH-OLD-DATA.patch | text/x-diff | 7.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2024-10-31 00:32:16 | Re: Interrupts vs signals |
Previous Message | Michael Paquier | 2024-10-31 00:13:40 | Re: Having problems generating a code coverage report |