Re: setting up foreign keys

From: Chris <dmagick(at)gmail(dot)com>
To: "Spiegelberg, Greg" <gspiegelberg(at)cranel(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: setting up foreign keys
Date: 2006-08-14 02:14:11
Message-ID: 44DFDC73.8000701@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Spiegelberg, Greg wrote:
> Sort of on topic, how many foreign keys in a single table is good v.
> bad? I realize it's relative to the tables the FK's reference so here's
> an example:
>
> Table A: 300 rows
> Table B: 15,000,000 rows
> Table C: 100,000 rows
> Table E: 38 rows
> Table F: 9 rows
> Table G: is partitioned on the FK from Table A and has a FK column for
> each of the above tables
>
> I'm in the process of normalizing the database and have a schema like
> this in mind. Works wonderfully for SELECT's but haven't gotten the
> data import process down just yet so I haven't had a chance to put it
> through it's paces. Depending on the performance of INSERT, UPDATE, and
> COPY I may drop the FK constraints since my app could enforce the FK
> checks.

As long as both sides of the FK's are indexed I don't think you'll have
a problem with a particular number of FK's per table.

--
Postgresql & php tutorials
http://www.designmagick.com/

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Jim C. Nasby 2006-08-14 15:38:41 Re: Postgresql Performance on an HP DL385 and
Previous Message Roman Neuhauser 2006-08-12 16:20:19 Re: most bang for buck with ~ $20,000