Re: Foreign Keys Constraints, perforamance analysis

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Daniel Åkerud <zilch(at)home(dot)se>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Foreign Keys Constraints, perforamance analysis
Date: 2001-06-25 16:13:26
Message-ID: Pine.BSF.4.21.0106250910020.22309-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 25 Jun 2001, [iso-8859-1] Daniel kerud wrote:

>
> OK, I've been discussing this with a collegue of mine... and I'm starting to
> see the light here...
>
> I will, first of all, make a new, simpler, 1<->1 realtionship to test FK
> constraints... no 2<->1<->2 relasionship here...
>
> Person -> Item/item_fkc
>
> And I will do no bulk-delete. Instead these tests:
>
> Fill person. no time measuring.
> Fill item, no foreign keys constraints, time measuring.
> Fill item, foreign keys constraints
> Compare last to measurments. How much do you loose in performance having the
> Foreign Key check?
> For all persons {
> if (fkc)
> delete from person where id = $id
> else
> delete from person where id = $id; delete from item where personid=$id
> }
> Compare measurements. How much do you loose having the foreign keys
> constraints delete the item?
>
> This, I think, this is a more fair comparison.
>
> Can you call the FK itself a foreign key constraint, as it actually is
> constraining something?

Yeah, that's a more even test. Since it sounds like you're writing
something on foreign key constraints (presumably about postgres), you
might want to mention the differences with table clearing deletes
but point out the foreign key constraints aren't generally used in
schemas where you're doing that :)

As for naming, I'd think so. It is a constraint, just that
"foreign key constraint" is much longer to type than FK :)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thalis A. Kalfigopoulos 2001-06-25 16:14:45 Re: Red Hat to support PostgreSQL
Previous Message Bruce Momjian 2001-06-25 16:05:20 MySQL comparison