pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Markus Schaber <schabi@logix-tt.com>
To: pgsql-performance@postgresql.org
Cc: Rodrigo Sakai <rodrigo.sakai@zanthus.com.br>
Subject: Re: FOREIGN KEYS  vs  PERFORMANCE
Date: Wed, 12 Apr 2006 15:18:55 +0200
Message-ID: <443CFE3F.5090304@logix-tt.com> (raw)
In-Reply-To: <72C39159-1A4B-4595-A978-1DF57AD42527@myrealbox.com>
References: <001301c65d9c$08884ef0$4700a8c0@TREEZANTHUS>
	<72C39159-1A4B-4595-A978-1DF57AD42527@myrealbox.com>

Hi, Michael,
Hi, Rodrigo,

Michael Glaesemann wrote:

> If I had to choose between one or the other, I'd leave all  referential
> integrity in the database and deal with the errors thrown  when
> referential integrity is violated in the application. PostgreSQL  is
> designed to handle these kinds of issues. Anything you code in  your
> application is more likely to contain bugs or miss corner cases  that
> would allow referential integrity to be violated. PostgreSQL has  been
> pounded on for years by a great many users and developers,  making the
> likelihood of bugs still remaining much smaller.

I strictly agree with Michael here.

> Of course, you can add some referential integrity checks in your
> application code, but those should be in addition to your database-
> level checks.

Agree. It does make sense to have reference checks in the UI or
application level for the sake of better error handling, but the
database should be the mandatory judge.

There's another advantage of database based checking: Should there ever
be the need of a different application working on the same database (e.
G. an "expert level UI", or some connector that connects / synchronizes
to another software, or a data import tool), database based constraints
cannot be broken opposed to application based ones.

HTH,
Markus
-- 
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org



view thread (19+ messages)  latest in thread

Message-ID: <443CFE3F.5090304@logix-tt.com>
Permalink:  ../443CFE3F.5090304@logix-tt.com/
Also on:    postgresql.org/message-id/443CFE3F.5090304@logix-tt.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: schabi@logix-tt.com, rodrigo.sakai@zanthus.com.br
  Subject: Re: FOREIGN KEYS  vs  PERFORMANCE
  In-Reply-To: <443CFE3F.5090304@logix-tt.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox