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 1lxybz-00079P-1B for pgsql-general@arkaria.postgresql.org; Mon, 28 Jun 2021 21:16:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lxyby-00045t-0e for pgsql-general@arkaria.postgresql.org; Mon, 28 Jun 2021 21:16:10 +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 1lxybx-00045l-O7 for pgsql-general@lists.postgresql.org; Mon, 28 Jun 2021 21:16:09 +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 1lxybv-0006hN-PO for pgsql-general@postgresql.org; Mon, 28 Jun 2021 21:16:08 +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 15SLG6cl342542; Mon, 28 Jun 2021 17:16:06 -0400 From: Tom Lane To: Ron cc: "pgsql-general@postgresql.org" Subject: Re: ALTER TABLE ... DETACH PARTITION just sitting there In-reply-to: References: Comments: In-reply-to Ron message dated "Mon, 28 Jun 2021 16:08:17 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <342540.1624914966.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 28 Jun 2021 17:16:06 -0400 Message-ID: <342541.1624914966@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Ron writes: > AWS RDS Postgresql 12.5. > We've got a table partitioned by month range (FOR VALUES FROM ('2011-07-= 01') = > TO (2011-08-01')), and I've been detaching partitions from oldest to new= est, = > one at a time. Whenever it's failed due to a FK constraint (and there ar= e = > many of them!), I dropped the "same month" partition from TABLE_B, and t= hen = > returned and dropped the partition from TABLE_A. > But now, after 17 dropped partitions it's just sitting there on "ALTER T= ABLE = > table_a DROP PARTITION table_a_p2011_07;"=C2=A0 I'm the only user on thi= s test = > instance, and validated that nothing else is blocking me. > Are the FK validations what's causing the apparent "hang"?=C2=A0 (EXPLAI= N ALTER = > TABLE... does not work.) Perhaps the corresponding TABLE_B partition lacks an index on the referencing column? I've not looked at how this particular case is implemented, but typically, lack of such an index is fine until you try to delete PK-side rows. regards, tom lane