Re: Full table lock dropping a foreign key

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Paul Jungwirth <pj(at)illuminatedcomputing(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Full table lock dropping a foreign key
Date: 2018-09-05 18:02:24
Message-ID: 1370.1536170544@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Paul Jungwirth <pj(at)illuminatedcomputing(dot)com> writes:
> I noticed that Postgres takes an AccessExclusiveLock (a lock on the
> whole table) against the *referenced* table when dropping a foreign key.

Yeah, that's because it involves removing a trigger.

Adding a trigger used to require AEL as well, but it was successfully
argued that that end of things could use a weaker lock. I find the
reasoning rather dubious myself.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Pacheco 2018-09-05 18:06:40 Re: Autovacuum degrades all other operations by keeping all buffers dirty?
Previous Message Johnes Castro 2018-09-05 17:53:50 RE: Max number of WAL files in pg_xlog directory for Postgres 9.2 version