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 1mRzHe-0005fX-SF for pgsql-bugs@arkaria.postgresql.org; Sun, 19 Sep 2021 16:03:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mRzHd-0006ob-Et for pgsql-bugs@arkaria.postgresql.org; Sun, 19 Sep 2021 16:03:13 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mRzHd-0006oT-7o for pgsql-bugs@lists.postgresql.org; Sun, 19 Sep 2021 16:03:13 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mRzHW-0004BR-LZ for pgsql-bugs@lists.postgresql.org; Sun, 19 Sep 2021 16:03: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 18JG349T1556208; Sun, 19 Sep 2021 12:03:04 -0400 From: Tom Lane To: Duncan Sands cc: pgsql-bugs@lists.postgresql.org Subject: Re: Query planning on partitioned table causes postgres 13.4 to consume all memory In-reply-to: <4a3115d4-0fb2-e214-93e3-9a9d0974b883@deepbluecap.com> References: <4a3115d4-0fb2-e214-93e3-9a9d0974b883@deepbluecap.com> Comments: In-reply-to Duncan Sands message dated "Fri, 17 Sep 2021 11:49:06 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1556206.1632067384.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 19 Sep 2021 12:03:04 -0400 Message-ID: <1556207.1632067384@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Duncan Sands writes: > [ planning DELETE on a thousand-partition table takes forever ] FWIW, this situation has been very much improved for v14 [1]. In older branches, the best advice I can give you is "don't use so many partitions". Especially not with hash partitioning, where the query WHERE clause generally won't translate to any useful pruning of the partitions. (Personally, I think that hash partitioning is an evil that we shouldn't have implemented at all. Or at least there should be stronger warnings about it in the manual than there are now.) regards, tom lane [1] https://git.postgresql.org/gitweb/?p=3Dpostgresql.git&a=3Dcommitdiff&h= =3D86dc90056