Re: Optimization of FK creation - Mailing list pgsql-general

From Tom Lane
Subject Re: Optimization of FK creation
Date
Msg-id 22495.1286548825@sss.pgh.pa.us
Whole thread Raw
In response to Optimization of FK creation  (Robert Ayrapetyan <robert.ayrapetyan@comodo.com>)
List pgsql-general
Robert Ayrapetyan <robert.ayrapetyan@comodo.com> writes:
> I think it's very easy to check if "table_foo" is empty and therefore
> not requires any locks on
> "parent_table" and generate FK immediately without acquiring the lock
> on "parent" table.

Unfortunately, that's complete nonsense.  The reason for the lock on the
parent is so that DDL changes can be applied to it, namely addition of
triggers.

            regards, tom lane

pgsql-general by date:

Previous
From: Robert Ayrapetyan
Date:
Subject: Optimization of FK creation
Next
From: Ugo PARSI
Date:
Subject: Segfault : PostgreSQL 9.0.0 and PgPool-II.