X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id ADD8ED1BA81 for ; Mon, 12 Jan 2004 09:53:27 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 17830-06 for ; Mon, 12 Jan 2004 05:52:58 -0400 (AST) Received: from anchor-post-35.mail.demon.net (anchor-post-35.mail.demon.net [194.217.242.85]) by svr1.postgresql.org (Postfix) with ESMTP id 9C0BCD1B432 for ; Mon, 12 Jan 2004 05:52:55 -0400 (AST) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-35.mail.demon.net with esmtp (Exim 3.35 #1) id 1Afykj-000CdP-0Z; Mon, 12 Jan 2004 09:52:57 +0000 Received: by mainbox.archonet.com (Postfix, from userid 529) id EA9CA16E2D; Mon, 12 Jan 2004 09:52:55 +0000 (GMT) Received: from client17.archonet.com (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id F0AFB16DC9; Mon, 12 Jan 2004 09:52:53 +0000 (GMT) From: Richard Huxton To: katarn , pgsql-sql@postgresql.org Subject: Re: Unique key field or serverl fks ? Date: Mon, 12 Jan 2004 09:52:53 +0000 User-Agent: KMail/1.5 References: <400235D5.1050501@racsa.co.cr> In-Reply-To: <400235D5.1050501@racsa.co.cr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200401120952.53629.dev@archonet.com> X-Bogosity: No, tests=bogofilter, spamicity=0.000000, version=0.15.3 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/92 X-Sequence-Number: 16485 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