RE: Implementing Incremental View Maintenance

From: "r(dot)takahashi_2(at)fujitsu(dot)com" <r(dot)takahashi_2(at)fujitsu(dot)com>
To: 'Zhihong Yu' <zyu(at)yugabyte(dot)com>, Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>
Cc: 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>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, 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-08-03 10:15:42
Message-ID: OS0PR01MB5682576A59A1C765F7AEDE6B82F09@OS0PR01MB5682.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Nagata-san,

I am interested in this patch since it is good feature.

I run some simple tests.
I found the following problems.

(1)
Failed to "make world".
I think there are extra "<lineitem>" in doc/src/sgml/ref/create_materialized_view.sgml
(line 110 and 117)

(2)
In the case of partition, it seems that IVM does not work well.
I run as follows.

postgres=# create table parent (c int) partition by range (c);
CREATE TABLE
postgres=# create table child partition of parent for values from (1) to (100);
CREATE TABLE
postgres=# create incremental materialized view ivm_parent as select c from parent;
NOTICE: could not create an index on materialized view "ivm_parent" automatically
HINT: Create an index on the materialized view for efficient incremental maintenance.
SELECT 0
postgres=# create incremental materialized view ivm_child as select c from child;
NOTICE: could not create an index on materialized view "ivm_child" automatically
HINT: Create an index on the materialized view for efficient incremental maintenance.
SELECT 0
postgres=# insert into parent values (1);
INSERT 0 1
postgres=# insert into child values (2);
INSERT 0 1
postgres=# select * from parent;
c
---
1
2
(2 rows)

postgres=# select * from child;
c
---
1
2
(2 rows)

postgres=# select * from ivm_parent;
c
---
1
(1 row)

postgres=# select * from ivm_child;
c
---
2
(1 row)

I think ivm_parent and ivm_child should return 2 rows.

(3)
I think IVM does not support foreign table, but try to make IVM.

postgres=# create incremental materialized view ivm_foreign as select c from foreign_table;
NOTICE: could not create an index on materialized view "ivm_foreign" automatically
HINT: Create an index on the materialized view for efficient incremental maintenance.
ERROR: "foreign_table" is a foreign table
DETAIL: Triggers on foreign tables cannot have transition tables.

It finally failed to make IVM, but I think it should be checked more early.

Regards,
Ryohei Takahashi

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2021-08-03 10:16:37 Re: Extra code in commit_ts.h
Previous Message vignesh C 2021-08-03 10:02:38 Re: [HACKERS] logical decoding of two-phase transactions