Re: Advice on index and constraint definition

From: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Advice on index and constraint definition
Date: 2014-09-21 01:55:02
Message-ID: 1411264502294-5819815.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

JORGE MALDONADO wrote
> Thanks for your answer. I am a DB novice and I still have questions, I
> would like you to explain a bit more about the following:
>
> " I'd generally question a design that uses 5 foreign keys on a matching
> table"
>
> Does this mean that my table with 5 foreign keys should have fewer foreign
> keys? How could I achieve this goal if such a table depends on 5 other
> tables? Maybe a must take into account a redesign of this precise table.

My point is a single table relating five other individual tables is quite
probably not properly normalized. If you are using multi-column primary
keys then the presence of 5 columns might only represent 2 source tables
which would be more 'normal'.

This kind of table typically is used for a direct many-to-many relationship
so having 5 foreign keys would definitely complicate the logic.

David J.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Advice-on-index-and-constraint-definition-tp5819799p5819815.html
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message amul sul 2014-09-22 05:54:54 Re: Unable to connect remotely to postgres server
Previous Message JORGE MALDONADO 2014-09-20 18:55:39 Re: Advice on index and constraint definition