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 1ibfPx-0005NO-QC for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Dec 2019 06:42:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ibfPw-0006rx-J4 for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Dec 2019 06:42:44 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ibfPw-0006rp-6y for pgsql-hackers@lists.postgresql.org; Mon, 02 Dec 2019 06:42:44 +0000 Received: from sraihb2.sra.co.jp ([202.32.10.6]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ibfPt-0008IH-DE for pgsql-hackers@postgresql.org; Mon, 02 Dec 2019 06:42:43 +0000 Received: from srascf.sra.co.jp (srascf [133.137.8.80]) by sraihb2.sra.co.jp (Postfix) with ESMTP id 356012A160D for ; Mon, 2 Dec 2019 15:42:39 +0900 (JST) Received: from srascb.sra.co.jp (unknown [133.137.8.65]) by srascf.sra.co.jp with smtp id 4440_337e_49c11fcc_1dd4_4514_a1b4_911e6745d1ba; Mon, 02 Dec 2019 15:42:38 +0900 Received: from sranhm.sra.co.jp (osspc25 [133.137.174.97]) by srascb.sra.co.jp (Postfix) with ESMTP id 0DB012D6944 for ; Mon, 2 Dec 2019 15:42:39 +0900 (JST) Received: from yugon-CFSV7-1 (dhcp-175-194.sra.co.jp [133.137.175.194]) by sranhm.sra.co.jp (Postfix) with SMTP id E7108A124F; Mon, 2 Dec 2019 15:42:38 +0900 (JST) Date: Mon, 2 Dec 2019 15:42:08 +0900 From: Yugo Nagata To: Tatsuo Ishii Cc: alvherre@2ndquadrant.com, pgsql-hackers@postgresql.org, hoshiai@sraoss.co.jp, thomas.munro@gmail.com, kgrittn@gmail.com Subject: Re: Implementing Incremental View Maintenance Message-Id: <20191202154208.b613271eff61bc34b570d009@sraoss.co.jp> In-Reply-To: <20191202.103636.874135993509990496.t-ishii@sraoss.co.jp> References: <20191128171052.ee3948fad09eb9337fcbbfc9@sraoss.co.jp> <20191128140333.GA25947@alvherre.pgsql> <20191129173328.e5a0e9f81e369a3769c4fd0c@sraoss.co.jp> <20191202.103636.874135993509990496.t-ishii@sraoss.co.jp> 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 On Mon, 02 Dec 2019 10:36:36 +0900 (JST) Tatsuo Ishii wrote: > >> One thing pending in this development line is how to catalogue aggregate > >> functions that can be used in incrementally-maintainable views. > >> I saw a brief mention somewhere that the devels knew it needed to be > >> done, but I don't see in the thread that they got around to doing it. > >> Did you guys have any thoughts on how it can be represented in catalogs? > >> It seems sine-qua-non ... > > > > Yes, this is a pending issue. Currently, supported aggregate functions are > > identified their name, that is, we support aggregate functions named "count", > > "sum", "avg", "min", or "max". As mentioned before, this is not robust > > because there might be user-defined aggregates with these names although all > > built-in aggregates can be used in IVM. > > > > In our implementation, the new aggregate values are calculated using "+" and > > "-" operations for sum and count, "/" for agv, and ">=" / "<=" for min/max. > > Therefore, if there is a user-defined aggregate on a user-defined type which > > doesn't support these operators, errors will raise. Obviously, this is a > > problem. Even if these operators are defined, the semantics of user-defined > > aggregate functions might not match with the way of maintaining views, and > > resultant might be incorrect. > > > > I think there are at least three options to prevent these problems. > > > > In the first option, we support only built-in aggregates which we know able > > to handle correctly. Supported aggregates can be identified using their OIDs. > > User-defined aggregates are not supported. I think this is the simplest and > > easiest way. > > I think this is enough for the first cut of IVM. So +1. If there is no objection, I will add the check of aggregate functions by this way. Thanks. Regards, Yugo Nagata -- Yugo Nagata