pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: katarn <katarn@racsa.co.cr>
To: pgsql-sql@postgresql.org
Subject: Re: Unique key field or serverl fks ?
Date: Mon, 12 Jan 2004 09:52:53 +0000
Message-ID: <200401120952.53629.dev@archonet.com> (raw)
In-Reply-To: <400235D5.1050501@racsa.co.cr>
References: <400235D5.1050501@racsa.co.cr>

On Monday 12 January 2004 05:51, katarn wrote:
> Hi,
>
> I would like to know opinions about which approach is better:
>
> Having a table with a field that works as a unique key, or having
> several fks that work as a combined key ( all the fks fields )?

Depends on the particular situation, you'll need to give details of the tables 
and their place in your system.

There are two reasons I've seen given for using an artificial (substitute) 
primary key:
1. It's "lighter" than several other fields (especially where they are text)
2. The natural primary key has meaning to the users, and the users will tend 
to get it wrong.

The second is probably the more persuasive - the first can definitely have 
costs as well as benefits.

-- 
  Richard Huxton
  Archonet Ltd



view thread (3+ messages)  latest in thread

Message-ID: <200401120952.53629.dev@archonet.com>
Permalink:  ../200401120952.53629.dev@archonet.com/
Also on:    postgresql.org/message-id/200401120952.53629.dev@archonet.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-sql@postgresql.org
  Cc: dev@archonet.com, katarn@racsa.co.cr
  Subject: Re: Unique key field or serverl fks ?
  In-Reply-To: <200401120952.53629.dev@archonet.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