Re: FOREIGN KEYS vs PERFORMANCE

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
Cc: Michael Glaesemann <grzm(at)myrealbox(dot)com>, Rodrigo Sakai <rodrigo(dot)sakai(at)zanthus(dot)com(dot)br>, pgsql-performance(at)postgresql(dot)org
Subject: Re: FOREIGN KEYS vs PERFORMANCE
Date: 2006-04-12 02:56:43
Message-ID: 13087.1144810603@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

"Jim C. Nasby" <jnasby(at)pervasive(dot)com> writes:
> On Wed, Apr 12, 2006 at 08:06:17AM +0900, Michael Glaesemann wrote:
>> ... 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.

> It's also pretty unlikely that you can make RI in the application
> perform better than in the database.

I think the traditional assumption among the "you should do RI in the
application" crowd is that the application has higher-level knowledge
that lets it understand when it can skip doing an RI check entirely.
Skipping an RI check is always faster than doing it --- so that's right,
it's faster. As long as you don't make any mistakes.

The question you have to ask yourself is whether you are really that
smart ... not just today, but every single time. To quote Clint
Eastwood: "Do you feel lucky punk? Well, do you?"

regards, tom lane

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message PFC 2006-04-12 07:19:18 Re: pgmemcache
Previous Message Christopher Kings-Lynne 2006-04-12 02:06:49 Re: Restore performance?