Re: Implementing Incremental View Maintenance

From: Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>
To: Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>
Cc: pgsql-hackers(at)postgresql(dot)org, "r(dot)takahashi_2(at)fujitsu(dot)com" <r(dot)takahashi_2(at)fujitsu(dot)com>, 'Zhihong Yu' <zyu(at)yugabyte(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com>, Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Re: Implementing Incremental View Maintenance
Date: 2021-10-29 09:16:28
Message-ID: 20211029181628.05e57c549c5b7058b1e5bc62@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

I attached the rebased patch set.

Regards,
Yugo Nagata

On Thu, 23 Sep 2021 04:57:30 +0900
Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp> wrote:

> On Wed, 22 Sep 2021 19:17:12 +0900
> Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp> wrote:
>
> > Hi hackers,
> >
> > I attached the updated patch including fixes reported by
> > Zhihong Yu and Ryohei Takahashi.
>
> Cfbot seems to fail to open the tar file, so I attached
> patch files instead of tar ball.
>
> Regards,
> Yugo Nagata
>
>
> > On Wed, 22 Sep 2021 19:12:27 +0900
> > Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp> wrote:
> >
> > > Hello Takahashi-san,
> > >
> > > On Mon, 6 Sep 2021 10:06:37 +0000
> > > "r(dot)takahashi_2(at)fujitsu(dot)com" <r(dot)takahashi_2(at)fujitsu(dot)com> wrote:
> > >
> > > > Hi Nagata-san,
> > > >
> > > >
> > > > I'm still reading the patch.
> > > > I have additional comments.
> > >
> > > Thank you for your comments!
> > >
> > > >
> > > > (1)
> > > > In v23-0001-Add-a-syntax-to-create-Incrementally-Maintainabl.patch, ivm member is added to IntoClause struct.
> > > > I think it is necessary to modify _copyIntoClause() and _equalIntoClause() functions.
> > >
> > > Ok. I'll fix _copyIntoClause() and _equalIntoClause() as well as _readIntoClause() and _outIntoClause().
> > >
> > > > (2)
> > > > By executing pg_dump with v23-0005-Add-Incremental-View-Maintenance-support-to-pg_d.patch,
> > > > the constraint which is automatically created during "CREATE INCREMENTAL MATERIALIZED VIEW" is also dumped.
> > > > This cause error during recovery as follows.
> > > >
> > > > ivm=# create table t (c1 int, c2 int);
> > > > CREATE TABLE
> > > > ivm=# create incremental materialized view ivm_t as select distinct c1 from t;
> > > > NOTICE: created index "ivm_t_index" on materialized view "ivm_t"
> > > > SELECT 0
> > > >
> > > > Then I executed pg_dump.
> > > >
> > > > In the dump, the following SQLs appear.
> > > >
> > > > CREATE INCREMENTAL MATERIALIZED VIEW public.ivm_t AS
> > > > SELECT DISTINCT t.c1
> > > > FROM public.t
> > > > WITH NO DATA;
> > > >
> > > > ALTER TABLE ONLY public.ivm_t
> > > > ADD CONSTRAINT ivm_t_index UNIQUE (c1);
> > > >
> > > > If I execute psql with the result of pg_dump, following error occurs.
> > > >
> > > > ERROR: ALTER action ADD CONSTRAINT cannot be performed on relation "ivm_t"
> > > > DETAIL: This operation is not supported for materialized views.
> > >
> > > Good catch! It was my mistake creating unique constraints on IMMV in spite of
> > > we cannot defined them via SQL. I'll fix it to use unique indexes instead of
> > > constraints.
> > >
> > > Regards,
> > > Yugo Nagata
> > >
> > > --
> > > Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>
> > >
> > >
> >
> >
> > --
> > Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>
>
>
> --
> Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>

--
Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>

Attachment Content-Type Size
v24-0001-Add-a-syntax-to-create-Incrementally-Maintainabl.patch text/x-diff 6.7 KB
v24-0002-Add-relisivm-column-to-pg_class-system-catalog.patch text/x-diff 4.7 KB
v24-0003-Add-new-deptype-option-m-in-pg_depend-system-cat.patch text/x-diff 1.7 KB
v24-0004-Allow-to-prolong-life-span-of-transition-tables-.patch text/x-diff 5.6 KB
v24-0005-Add-Incremental-View-Maintenance-support-to-pg_d.patch text/x-diff 4.2 KB
v24-0006-Add-Incremental-View-Maintenance-support-to-psql.patch text/x-diff 4.8 KB
v24-0007-Add-Incremental-View-Maintenance-support.patch text/x-diff 90.0 KB
v24-0008-Add-aggregates-support-in-IVM.patch text/x-diff 55.1 KB
v24-0009-Add-regression-tests-for-Incremental-View-Mainte.patch text/x-diff 46.0 KB
v24-0010-Add-documentations-about-Incremental-View-Mainte.patch text/x-diff 25.0 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message gkokolatos 2021-10-29 09:45:41 Re: Teach pg_receivewal to use lz4 compression
Previous Message Michael Paquier 2021-10-29 09:10:22 Re: Add support for ALTER INDEX .. ALTER [COLUMN] col_num {SET,RESET}