pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Ron <ronljohnsonjr@gmail.com>
Cc: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Subject: Re: ALTER TABLE ... DETACH PARTITION just sitting there
Date: Mon, 28 Jun 2021 17:19:02 -0400
Message-ID: <202106282119.cu7zz7pzcd7n@alvherre.pgsql> (raw)
In-Reply-To: <a9cedc4d-ffe8-01a5-bd09-5fe039b44075@gmail.com>

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
<inflex> really, I see PHP as like a strange amalgamation of C, Perl, Shell
<crab> inflex: you know that "amalgam" means "mixture with mercury",
       more or less, right?
<crab> i.e., "deadly poison"





view thread (5+ messages)  latest in thread

Message-ID: <202106282119.cu7zz7pzcd7n@alvherre.pgsql>
Permalink:  ../202106282119.cu7zz7pzcd7n@alvherre.pgsql/
Also on:    postgresql.org/message-id/202106282119.cu7zz7pzcd7n@alvherre.pgsql

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: alvherre@alvh.no-ip.org, ronljohnsonjr@gmail.com
  Subject: Re: ALTER TABLE ... DETACH PARTITION just sitting there
  In-Reply-To: <202106282119.cu7zz7pzcd7n@alvherre.pgsql>
  References: <a9cedc4d-ffe8-01a5-bd09-5fe039b44075@gmail.com> <202106282119.cu7zz7pzcd7n@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox