Re: Unique key field or serverl fks ?

From: Richard Huxton <dev(at)archonet(dot)com>
To: katarn <katarn(at)racsa(dot)co(dot)cr>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Unique key field or serverl fks ?
Date: 2004-01-12 09:52:53
Message-ID: 200401120952.53629.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Robert Creager 2004-01-12 13:05:45 Re: Problem with NOT IN portion of query.
Previous Message Richard Huxton 2004-01-12 09:45:18 Re: Select into