Re: Optimization of FK creation

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Ayrapetyan <robert(dot)ayrapetyan(at)comodo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Optimization of FK creation
Date: 2010-10-08 14:40:25
Message-ID: 22495.1286548825@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Robert Ayrapetyan <robert(dot)ayrapetyan(at)comodo(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ugo PARSI 2010-10-08 16:47:06 Segfault : PostgreSQL 9.0.0 and PgPool-II.
Previous Message Robert Ayrapetyan 2010-10-08 14:33:08 Optimization of FK creation