Re: Are there known performance issues with defining all Foreign Keys as deferrable initially immediate

From: Craig Ringer <ringerc(at)ringerc(dot)id(dot)au>
To: "McKinzie, Alan (Alan)" <alanmck(at)avaya(dot)com>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Are there known performance issues with defining all Foreign Keys as deferrable initially immediate
Date: 2012-09-16 14:12:13
Message-ID: 5055DE3D.4040603@ringerc.id.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 09/16/2012 09:45 PM, Craig Ringer wrote:

> This seems under-documented and I haven't found much good info on it,
> so the best thing to do is test it.

Found it, it's in the NOTES for CREATE TABLE.

http://www.postgresql.org/docs/current/static/sql-createtable.html:

When a UNIQUE or PRIMARY KEY constraint is not deferrable, PostgreSQL
checks for uniqueness immediately whenever a row is inserted or
modified. The SQL standard says that uniqueness should be enforced only
at the end of the statement; this makes a difference when, for example,
a single command updates multiple key values. To obtain
standard-compliant behavior, declare the constraint as DEFERRABLE but
not deferred (i.e., INITIALLY IMMEDIATE). Be aware that this can be
significantly slower than immediate uniqueness checking.

--
Craig Ringer

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2012-09-16 15:37:15 Re: Are there known performance issues with defining all Foreign Keys as deferrable initially immediate
Previous Message Craig Ringer 2012-09-16 13:45:35 Re: Are there known performance issues with defining all Foreign Keys as deferrable initially immediate