pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: L D <lenardd@hotmail.com>
To: pgsql-sql@postgresql.org
Subject: PK & FK & Index Question
Date: Sun, 2 Sep 2007 19:12:06 -0200
Message-ID: <BAY120-W14B9D62D95DF7DDBF8794BBBC80@phx.gbl> (raw)


Hi All,
 
Assume the following have a one-to-one relationship:
 
team_contact
     team_contact_id  (PK)
     first_name     last_name
     ...
 
team_contact_contacts
     team_contact_id  (FK)
     home_phone     work_phone
     ...
 
 
Should I set the latter table's FK also to PK?  If so, do I need to set an index on the FK even though it's also the primary key?
 
Alternatively, I could just add a UK contraint to FK and do away with PK, right?
 
Thanks.
 
--Lenard    
 
 
 
_________________________________________________________________
Connect to the next generation of MSN Messenger 
http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline=

Message-ID: <BAY120-W14B9D62D95DF7DDBF8794BBBC80@phx.gbl>
Permalink:  ../BAY120-W14B9D62D95DF7DDBF8794BBBC80@phx.gbl/
Also on:    postgresql.org/message-id/BAY120-W14B9D62D95DF7DDBF8794BBBC80@phx.gbl

 · 

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-sql@postgresql.org
  Cc: lenardd@hotmail.com
  Subject: Re: PK & FK & Index Question
  In-Reply-To: <BAY120-W14B9D62D95DF7DDBF8794BBBC80@phx.gbl>

* 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