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 1qT50T-008Kix-KE for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Aug 2023 18:31:05 +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 1qT50S-00Axdl-1d for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Aug 2023 18:31:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qT50R-00Axdd-NB for pgsql-hackers@lists.postgresql.org; Mon, 07 Aug 2023 18:31:04 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qT50M-0018h6-Vo for pgsql-hackers@postgresql.org; Mon, 07 Aug 2023 18:31:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=momjian.us; s=2023062407; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description; bh=V3hUQr/HTJzkU/D4Y5R6uOYNzq3PC6f5oXJ1mCF5BQk=; b=EONJo bEdul3VF7lS8tsI8JLvlaIiuk88aGbQxuAM9l+L1zQ+JPOkpPu5J2x+JNg5H2XRFIlR1Xm+lzaPDQ FcxivG3Gx7AermjYjhSENPYsMaDF5b3b7QDxt6l4tfCkchQEoA/RyvZ2ie8qRhi78CSywO3DKV8Oo f3D6cOMJ33rpXRJcH0UmB+o7edNN3xrbD3QlZxLBM2++1fubBBeCj1r3sfdvA5u8kHxS0TlVHVLXK K5dZp0Qyz7ZBKg3Q3JZStIxVe2d8G8X+i8wUwcHxrA+0Srff3eooGP956KpgDI+v3oHEOL3A2ccc5 8fzYKE02DzsuhjeAjs5xWeU2AkLyw==; Received: from bruce by momjian.us with local (Exim 4.96) (envelope-from ) id 1qT50I-0001xA-0A; Mon, 07 Aug 2023 14:30:54 -0400 Date: Mon, 7 Aug 2023 14:30:54 -0400 From: Bruce Momjian To: "Fujii.Yuki@df.MitsubishiElectric.co.jp" Cc: Alexander Pyhalov , PostgreSQL-development , Andres Freund , Tom Lane , Tomas Vondra , Julien Rouhaud , Daniel Gustafsson , Ilya Gladyshev Subject: Re: Partial aggregates pushdown Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Jul 10, 2023 at 07:35:27AM +0000, Fujii.Yuki@df.MitsubishiElectric.co.jp wrote: > > > I will add a postgres_fdw option "check_partial_aggregate_support". > > > This option is false, default. > > > Only if this option is true, postgres_fdw connect to the remote server and get the version of the remote server. > > > And if the version of the remote server is less than PG17, then partial aggregate push down to the remote server is > > disable. > > > > Great! > I have modified the program except for the point "if the version of the remote server is less than PG17". > Instead, we have addressed the following. > "If check_partial_aggregate_support is true and the remote server version is older than the local server > version, postgres_fdw does not assume that the partial aggregate function is on the remote server unless > the partial aggregate function and the aggregate function match." > The reason for this is to maintain compatibility with any aggregate function that does not support partial > aggregate in one version of V1 (V1 is PG17 or higher), even if the next version supports partial aggregate. > For example, string_agg does not support partial aggregation in PG15, but it will support partial aggregation > in PG16. Just to clarify, I think you are saying: If check_partial_aggregate_support is true and the remote server version is older than the local server version, postgres_fdw checks if the partial aggregate function exists on the remote server during planning and only uses it if it does. I tried to phrase it in a positive way, and mentioned the plan time distinction. Also, I am sorry I was away for most of July and am just getting to this. -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com Only you can decide what is important to you.