Immediate Constraints

From: Perry Smith <pedzsan(at)gmail(dot)com>
To: PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: Immediate Constraints
Date: 2013-08-15 16:14:20
Message-ID: 08B90EEC-67FE-416D-9B3B-1018EF035769@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

The direct question is: what is the advantage of an immediate constraint?

My habit is to add constraints to my databases and my first lesson was to make them "deferrable". But a recent fight with pg_restore taught me that to do a pg_restore that is complex, you need to defer the constraints. I cobbled a way to do that as I do the pg_restore.

But that raised a question of why not just make the constraints all "deferred" and simplify my pg_restore process.

Are immediate constraints more efficient? Does this relate to transaction isolation in that the data would be consistent after each statement and therefor give better stability when multiple transactions are running at the same time?

My brain is asking this question because so far in my experience, the issues with constraints are solved by making them deferred. If I made them immediate, would I just bump into a different set of issues whose solution would be to make the constraints immediate?

Thank you,
Perry

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Steve Crawford 2013-08-15 16:39:23 Re: Debugging Postgres?
Previous Message Guy Helmer 2013-08-15 15:59:47 Re: SSL connection has been closed unexpectedly