Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oBOAv-0002Kd-Ug for pgsql-bugs@arkaria.postgresql.org; Tue, 12 Jul 2022 22:16:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oBOAu-0005wz-0o for pgsql-bugs@arkaria.postgresql.org; Tue, 12 Jul 2022 22:16:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oBOAt-0005wG-Oj for pgsql-bugs@lists.postgresql.org; Tue, 12 Jul 2022 22:16:11 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oBOAn-0005lT-DE for pgsql-bugs@lists.postgresql.org; Tue, 12 Jul 2022 22:16:11 +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 26CMFsV81942041; Tue, 12 Jul 2022 18:15:54 -0400 From: Tom Lane To: chjischj@163.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17548: Aggregate queries on partitioned tables can cause OOM. In-reply-to: <17548-4d206a94ee58f3a5@postgresql.org> References: <17548-4d206a94ee58f3a5@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Tue, 12 Jul 2022 16:25:58 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1942039.1657664154.1@sss.pgh.pa.us> Date: Tue, 12 Jul 2022 18:15:54 -0400 Message-ID: <1942040.1657664154@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: > Aggregate queries on partitioned tables can cause out of memory error. This is resolved in PG v13 and later. In older versions, it's advisable to do an explicit ANALYZE on a large table, so that the planner knows that the number of groups is large and will avoid trying to do a hash aggregation. (I don't think it's terribly specific to partitioned tables, for what that's worth, except that stats for a partitioned table might be more likely to be out-of-date.) regards, tom lane