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 13:45:35 |
Message-ID: | 5055D7FF.2070908@ringerc.id.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
On 09/14/2012 11:56 PM, McKinzie, Alan (Alan) wrote:
> My underlying question/concern is "will this change have any adverse
> affects (on performance) during normal operations when the foreign keys
> are set to deferrable initially immediate" .vs. the foreign keys being
> defined as NOT DEFERRABLE.
AFAIK in PostgreSQL DEFERRABLE INITIALLY IMMEDIATE is different to NOT
DEFERRABLE.
DEFERRABLE INITIALLY IMMEDIATE is executed at the end of the statement,
while NOT DEFERRABLE is executed as soon as it arises.
http://www.postgresql.org/docs/current/static/sql-set-constraints.html
Again from memory there's a performance cost to deferring constraint
checks to the end of the statement rather than doing them as soon as
they arise, so NOT DEFERRED can potentially perform better or at least
not hit limits that DEFERRABLE INITIALLY DEFERRED might hit in Pg.
This seems under-documented and I haven't found much good info on it, so
the best thing to do is test it.
--
Craig Ringer
From | Date | Subject | |
---|---|---|---|
Next Message | Craig Ringer | 2012-09-16 14:12:13 | Re: Are there known performance issues with defining all Foreign Keys as deferrable initially immediate |
Previous Message | Umesh Kirdat | 2012-09-16 03:48:15 | PostgreSQL performance on 64 bit as compared to 32 bit |