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 1rWmfG-007COx-Fg for pgsql-bugs@arkaria.postgresql.org; Mon, 05 Feb 2024 00:16:47 +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 1rWmfF-009SfD-Bn for pgsql-bugs@arkaria.postgresql.org; Mon, 05 Feb 2024 00:16:45 +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 1rWmfF-009Sf5-3G for pgsql-bugs@lists.postgresql.org; Mon, 05 Feb 2024 00:16:45 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rWmfC-005UdJ-S3 for pgsql-bugs@lists.postgresql.org; Mon, 05 Feb 2024 00:16:44 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 4150GeNL4148242; Sun, 4 Feb 2024 19:16:40 -0500 From: Tom Lane To: efremov20081@gmail.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18330: The query planner chooses the wrong plan when using the parallel aggregation function In-reply-to: <18330-1823d6d59e6936c3@postgresql.org> References: <18330-1823d6d59e6936c3@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Sun, 04 Feb 2024 20:35:02 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4148240.1707092200.1@sss.pgh.pa.us> Date: Sun, 04 Feb 2024 19:16:40 -0500 Message-ID: <4148241.1707092200@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > Below is an example of queries. It shows that the query planner chooses > sequential aggregation instead of parallel, although limit should not have > affected this. On what grounds do you assert that LIMIT can be parallelized? AFAICS it has to be done by a single process to ensure that the limit is enforced accurately. So LIMIT below an aggregation removes the opportunity to parallelize the aggregation. regards, tom lane