Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hgnho-00048W-KX for pgsql-hackers@arkaria.postgresql.org; Fri, 28 Jun 2019 10:02:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hgnhm-0006ye-UZ for pgsql-hackers@arkaria.postgresql.org; Fri, 28 Jun 2019 10:02:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hgnhm-0006vG-K3 for pgsql-hackers@lists.postgresql.org; Fri, 28 Jun 2019 10:02:06 +0000 Received: from sraihb2.sra.co.jp ([202.32.10.6]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hgnhj-0007Bj-HV for pgsql-hackers@postgresql.org; Fri, 28 Jun 2019 10:02:06 +0000 Received: from srascf.sra.co.jp (srascf [133.137.8.80]) by sraihb2.sra.co.jp (Postfix) with ESMTP id 48BEE2A1621 for ; Fri, 28 Jun 2019 19:02:00 +0900 (JST) Received: from srascb.sra.co.jp (unknown [133.137.8.65]) by srascf.sra.co.jp with smtp id 40ee_1cdc_42a59b8f_87ae_4b47_947e_6eed40214e5f; Fri, 28 Jun 2019 19:01:59 +0900 Received: from sranhm.sra.co.jp (osspc25 [133.137.174.97]) by srascb.sra.co.jp (Postfix) with ESMTP id 2889E2D6943 for ; Fri, 28 Jun 2019 19:02:00 +0900 (JST) Received: from yugon-CFSV7-1 (dhcp-175-183.sra.co.jp [133.137.175.183]) by sranhm.sra.co.jp (Postfix) with SMTP id 04602A1092; Fri, 28 Jun 2019 19:01:59 +0900 (JST) Date: Fri, 28 Jun 2019 19:01:43 +0900 From: Yugo Nagata To: Jim Finnerty Cc: pgsql-hackers@postgresql.org Subject: Re: Implementing Incremental View Maintenance Message-Id: <20190628190143.0e006e12d77458ecff12cf54@sraoss.co.jp> In-Reply-To: <1561131671319-0.post@n3.nabble.com> References: <20181227215726.4d166b4874f8983a641123f5@sraoss.co.jp> <20190401121122.a84d8dff0bd13eaccd373135@sraoss.co.jp> <20190514154648.63fea174748c18ed7f7dcb16@sraoss.co.jp> <20190620164410.0218e26e0bdedb7574dec2eb@sraoss.co.jp> <1561131671319-0.post@n3.nabble.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi Jim, On Fri, 21 Jun 2019 08:41:11 -0700 (MST) Jim Finnerty wrote: > Hi Yugo, > > I'd like to compare the performance of your MV refresh algorithm versus > an approach that logs changes into an mv log table, and can then apply the > changes at some later point in time. I'd like to handle the materialized > join view (mjv) case first, specifically a 2-way left outer join, with a UDF > in the SELECT list of the mjv. Do you mean you have your implementation of IVM that using log tables? I'm so interested in this, and I would appreciate it if you explain the detail. > Does your refresh algorithm handle mjv's with connected join graphs that > consist entirely of inner and left outer joins? > If so, I'd like to measure the overhead of your refresh algorithm on > pgbench, modified to include an mjv, versus a (hand coded) incremental > maintenance algorithm that uses mv log tables populated by ordinary > triggers. We may also want to look at capturing the deltas using logical > replication, which ought to be faster than a trigger-based solution. In the current our implementation, outer joins is not yet supported though we plan to handle this in future. So,we would not be able to compare these directly in the same workload in the current status. However, the current our implementation supports only the way to update materialized views in a trigger, and the performance of modifying base tables will be lower than the approach which uses log tables. This is because queries to update materialized views are issued in the trigger. This is not only a overhead itself, but also takes a lock on a materialized view, which has an ] impact on concurrent execution performance. In the previous our PoC, we implemented IVM using log tables, in which logs are captured by triggers and materialized views are update incrementally by a user command[1]. However, to implement log table approach, we need a infrastructure to maintain these logs. For example, which logs are necessary and which logs can be discarded, etc. We thought this is not trivial work, so we decided to start from the current approach which doesn't use log tables. We are now preparing to implement this in the next step because this is also needed to support deferred maintenance of views. [1] https://www.postgresql.eu/events/pgconfeu2018/schedule/session/2195-implementing-incremental-view-maintenance-on-postgresql/ I agree that capturing the deltas using logical decoding will be faster than using a trigger although we haven't yet consider this well. Best regadrds, Yugo Nagata -- Yugo Nagata