pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chris <dmagick@gmail.com>
To: Spiegelberg, Greg <gspiegelberg@cranel.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: setting up foreign keys
Date: Mon, 14 Aug 2006 12:14:11 +1000
Message-ID: <44DFDC73.8000701@gmail.com> (raw)
In-Reply-To: <82E74D266CB9B44390D3CCE44A781ED901368432@POSTOFFICE.cranel.local>
References: <82E74D266CB9B44390D3CCE44A781ED901368432@POSTOFFICE.cranel.local>

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/



view thread (12+ messages)  latest in thread

Message-ID: <44DFDC73.8000701@gmail.com>
Permalink:  ../44DFDC73.8000701@gmail.com/
Also on:    postgresql.org/message-id/44DFDC73.8000701@gmail.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: dmagick@gmail.com, gspiegelberg@cranel.com
  Subject: Re: setting up foreign keys
  In-Reply-To: <44DFDC73.8000701@gmail.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