From: | Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp> |
---|---|
To: | Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp> |
Cc: | Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>, Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp>, michael(at)paquier(dot)xyz, thomas(dot)munro(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org, takuma(dot)hoshiai(at)gmail(dot)com, amitlangote09(at)gmail(dot)com, alvherre(at)2ndquadrant(dot)com, kgrittn(at)gmail(dot)com |
Subject: | Re: Implementing Incremental View Maintenance |
Date: | 2020-10-05 09:16:18 |
Message-ID: | 20201005181618.31f2baf8583358fcfbed26cd@sraoss.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
Attached is the rebased patch (v18) to add support for Incremental
Materialized View Maintenance (IVM). It is able to be applied to
current latest master branch.
Also, this now supports simple CTEs (WITH clauses) which do not contain
aggregates or DISTINCT like simple sub-queries. This feature is provided
as an additional patch segment "0010-Add-CTE-support-in-IVM.patch".
==== Example ====
cte=# TABLE r;
i | v
---+----
1 | 10
2 | 20
(2 rows)
cte=# TABLE s;
i | v
---+-----
2 | 200
3 | 300
(2 rows)
cte=# \d+ mv
Materialized view "public.mv"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+---------+-----------+----------+---------+---------+--------------+-------------
r | integer | | | | plain | |
x | integer | | | | plain | |
View definition:
WITH x AS (
SELECT s.i,
s.v
FROM s
)
SELECT r.v AS r,
x.v AS x
FROM r,
x
WHERE r.i = x.i;
Access method: heap
Incremental view maintenance: yes
cte=# SELECT * FROM mv;
r | x
----+-----
20 | 200
(1 row)
cte=# INSERT INTO r VALUES (3,30);
INSERT 0 1
cte=# INSERT INTO s VALUES (1,100);
INSERT 0 1
cte=# SELECT * FROM mv;
r | x
----+-----
20 | 200
30 | 300
10 | 100
(3 rows)
======================
Regards,
Yugo Nagata
--
Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>
Attachment | Content-Type | Size |
---|---|---|
IVM_patches_v18.tar.gz | application/gzip | 79.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | k.jamison@fujitsu.com | 2020-10-05 09:34:13 | RE: [Patch] Optimize dropping of relation buffers using dlist |
Previous Message | Amit Kapila | 2020-10-05 08:50:51 | Re: Resetting spilled txn statistics in pg_stat_replication |