Re: FOREIGN KEYS vs PERFORMANCE - Mailing list pgsql-performance

From Scott Marlowe
Subject Re: FOREIGN KEYS vs PERFORMANCE
Date
Msg-id 1144784926.32269.88.camel@state.g2switchworks.com
Whole thread Raw
In response to FOREIGN KEYS vs PERFORMANCE  ("Rodrigo Sakai" <rodrigo.sakai@zanthus.com.br>)
List pgsql-performance
On Tue, 2006-04-11 at 14:13, Rodrigo Sakai wrote:
>   Hi,
>
>   I think this is an old question, but I want to know if it really is
> well worth to not create some foreign keys an deal with the
> referential integrity at application-level?????
>   Specifically, the system we are developing is a server/cliente
> architecture that the server is the database and the fat client is an
> application developed in DELPHI!!!
>

If ref integrity is important, you'll have to do it either in the app or
the database.

Almost always, it's faster to let the database do it, as there's less
traffic across the wire required to maintain ref integrity, plus, the
guys who wrote the database have spent years making sure race conditions
won't scram your data.

For simple, straight forward FK->PK relationships, you will likely NOT
be able to beat the database in terms of either reliability or
performance with your own code.

pgsql-performance by date:

Previous
From: "Rodrigo Sakai"
Date:
Subject: FOREIGN KEYS vs PERFORMANCE
Next
From: Dan Harris
Date:
Subject: Re: Encouraging multi-table join order