Re: [HACKERS] ADD FOREIGN KEY locking

2015-02-17 Thread Michael Paquier
On Wed, Feb 18, 2015 at 9:06 AM, James Sewell james.sew...@lisasoft.com wrote: I've just noticed something in the Commit fest post - Reducing lock strength of trigger and foreign key DDL This reduces the lock taken for ADD FOREIGN KEY to ShareRowExclusiveLock, authorizing SELECT and SELECT

[HACKERS] ADD FOREIGN KEY locking

2015-02-17 Thread James Sewell
Hello all, When I add a FK with a statement like this: ALTER TABLE a ADD FOREIGN KEY (id) REFERENCES b(id); I see a lock on table b: select locktype,mode,granted from pg_locks, pg_stat_activity where relation::regclass::text = 'b' AND pg_locks.pid = pg_stat_activity.pid; locktype | relation

Re: [HACKERS] ADD FOREIGN KEY locking

2015-02-17 Thread James Sewell
Oh, I've just noticed something in the Commit fest post - Reducing lock strength of trigger and foreign key DDL Perhaps I just need to be more patient. Cheers, James Sewell, Solutions Architect __ Level 2, 50 Queen St, Melbourne VIC 3000 *P *(+61) 3