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 1lxyex-0007EV-RN for pgsql-general@arkaria.postgresql.org; Mon, 28 Jun 2021 21:19:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lxyew-00080b-Mt for pgsql-general@arkaria.postgresql.org; Mon, 28 Jun 2021 21:19:14 +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 1lxyev-00080R-QE for pgsql-general@lists.postgresql.org; Mon, 28 Jun 2021 21:19:14 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lxyer-0000Px-MA for pgsql-general@postgresql.org; Mon, 28 Jun 2021 21:19:13 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 536963200368; Mon, 28 Jun 2021 17:19:06 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 28 Jun 2021 17:19:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=2VqCakWfkX91F3KfoSfL30Rj1YNdyjLrmAsdJneUao0=; b=IyjQ3zcU GgAJW1857w7ZL9+NHFZBeP8WEcuBQwRNUh1SJIVEKdY7oLocDFwMM4noFLbzCyEu IXwdhc65fOFCn+B+MO9LukMq5K7wCQkH6+JamVVcBVFxAORFf6wIkJKaBbO6G4K2 lpfohmPJnX2sx1lAQnOcoTJjw7x7G8qKBJINFKlbo4UK3eEvpx5VWhI1nRCzHMMa 5zGK91GNMmNJ21jb18nuOH43DUduvb0Z+TaTv8Axp08mbyoRCROtDmrp0/znHDy9 aYikIVTTFmJybKe2zh3oeG303GbOehtOpekxmqPbKhFEe/1bqDjYl4MmmmJTDNO5 x35WsbgRECh4uw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeehgedgudehlecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepfffhvffukfggtggugfgjsehtke ertddttddunecuhfhrohhmpeetlhhvrghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhr vgesrghlvhhhrdhnohdqihhprdhorhhgqeenucggtffrrghtthgvrhhnpeeggeevveffve ejffdutefhvddtgeeghffhgfeuhfefjeeigfevhfefleevtdduteenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhvhhgvrhhrvgesrghlvh hhrdhnohdqihhprdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 28 Jun 2021 17:19:05 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id A39D42A054B; Mon, 28 Jun 2021 17:19:02 -0400 (-04) Date: Mon, 28 Jun 2021 17:19:02 -0400 From: Alvaro Herrera To: Ron Cc: "pgsql-general@postgresql.org" Subject: Re: ALTER TABLE ... DETACH PARTITION just sitting there Message-ID: <202106282119.cu7zz7pzcd7n@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2021-Jun-28, Ron wrote: > 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 newest, > one at a time. Whenever it's failed due to a FK constraint (and there are > many of them!), I dropped the "same month" partition from TABLE_B, and then > returned and dropped the partition from TABLE_A. > > But now, after 17 dropped partitions it's just sitting there on "ALTER TABLE > table_a DROP PARTITION table_a_p2011_07;"  I'm the only user on this test > instance, and validated that nothing else is blocking me. Did you look in pg_locks for ungranted locks? > Are the FK validations what's causing the apparent "hang"?  (EXPLAIN ALTER > TABLE... does not work.) Sure, it is possible. Do you have any FKs that are missing indexes in the referencing side? -- Álvaro Herrera Valdivia, Chile really, I see PHP as like a strange amalgamation of C, Perl, Shell inflex: you know that "amalgam" means "mixture with mercury", more or less, right? i.e., "deadly poison"