Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rgySf-008wJm-1B for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Mar 2024 02:53:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rgySc-003RLy-RN for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Mar 2024 02:53:51 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rgySc-003RKk-I3 for pgsql-hackers@lists.postgresql.org; Mon, 04 Mar 2024 02:53:51 +0000 Received: from ml.sraoss.co.jp ([66.11.59.17]) by makus.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rgySX-002jA7-HW for pgsql-hackers@postgresql.org; Mon, 04 Mar 2024 02:53:48 +0000 Received: from sranhm.sraoss.co.jp (unknown [192.168.174.164]) by osspc26.sraoss.co.jp (Postfix) with ESMTP id DBDC52F0008A; Mon, 4 Mar 2024 11:53:44 +0900 (JST) Received: from yugon-CFSV7-1 (unknown [192.168.176.24]) by sranhm.sraoss.co.jp (Postfix) with SMTP id C22843417CC; Mon, 4 Mar 2024 11:53:44 +0900 (JST) Date: Mon, 4 Mar 2024 11:53:44 +0900 From: Yugo NAGATA To: jian he Cc: pgsql-hackers@postgresql.org Subject: Re: Incremental View Maintenance, take 2 Message-Id: <20240304115344.01b363b0d02738a2b49cf9bd@sraoss.co.jp> In-Reply-To: References: <20230601235909.0e1572c27e59112f9d0cbe86@sraoss.co.jp> <20230601034703.9e4f81f5d92ae6e3949b84d2@sraoss.co.jp> <20230628170604.505955118ac2f91abd554f13@sraoss.co.jp> <20230828024908.2667bcde8d2963256375bd6c@sraoss.co.jp> <20230828115252.c1b018605b9a0756a30c3382@sraoss.co.jp> <20230828160530.adde1e20f257d7d345989163@sraoss.co.jp> X-Mailer: Sylpheed 3.7.0 (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: Archived-At: Precedence: bulk On Fri, 1 Sep 2023 15:42:17 +0800 jian he wrote: I apologize for this late reply. > I added a new function append_update_set_caluse, and deleted > functions: {append_set_clause_for_count, append_set_clause_for_sum, > append_set_clause_for_avg, append_set_clause_for_minmax} > > I guess this way is more extensible/generic than yours. Do you mean that consolidating such functions to a general function make easier to support a new aggregate function in future? I'm not convinced completely yet it because your suggestion seems that every functions' logic are just put into a new function, but providing a common interface might make a sense a bit. By the way, when you attach files other than updated patches that can be applied to master branch, using ".patch" or ".diff" as the file extension help to avoid to confuse cfbot (for example, like basedon_v29_matview_c_refactor_update_set_clause.patch.txt). > src/backend/commands/matview.c > 2268: /* For tuple deletion */ > maybe "/* For tuple deletion and update*/" is more accurate? This "deletion" means deletion of tuple from the view rather than DELETE statement, so I think this is ok. > Since the apply delta query is quite complex, I feel like adding some > "if debug then print out the final querybuf.data end if" would be a > good idea. Agreed, it would be helpful for debugging. I think it would be good to add a debug macro that works if DEBUG_IVM is defined rather than adding GUC like debug_print_..., how about it? > we add hidden columns somewhere, also to avoid corner cases, so maybe > somewhere we should assert total attribute number is sane. The number of hidden columns to be added depends on the view definition query, so I wonder the Assert condition would be a bit complex. Could you explain what are you assume about like for example? Regards, Yugo Nagata -- Yugo NAGATA