This is a discussion on PK & FK & Index Question within the pgsql Sql forums, part of the PostgreSQL category; --> 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 ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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/lau...=wlmailtagline |
| ||||
| On 9/2/07, L D <lenardd@hotmail.com> wrote: > Should I set the latter table's FK also to PK? It's sane. > If so, do I need to set an index on the FK even though it's also the primary key? No need to do so. ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match |