Re: NOT DEFERRABLE vs. DEFERRABLE INITIALLY IMMEDIATE constraints

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: NOT DEFERRABLE vs. DEFERRABLE INITIALLY IMMEDIATE constraints
Date: 2014-02-06 19:46:02
Message-ID: 23474.1391715962@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jeff Janes <jeff(dot)janes(at)gmail(dot)com> writes:
> I've been plagued several times by NOT DEFERRABLE constraints. Is there
> any good reason to define a constraint as NOT DEFERRABLE rather
> than DEFERRABLE INITIALLY IMMEDIATE? For example, is there performance
> penalty for PostgreSQL being prepared to defer a constraint even though it
> is not currently being deferred?

There's a substantial performance difference between deferrable and
nondeferrable uniqueness constraints (ie, indexes). For foreign keys
I don't believe it matters. We don't implement deferrability for
other types of constraints such as CHECK.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2014-02-06 19:54:17 Re: Offending My Tender Sensibilities -OR- OLTP on a Star Schema
Previous Message Jeff Janes 2014-02-06 19:26:03 NOT DEFERRABLE vs. DEFERRABLE INITIALLY IMMEDIATE constraints