Re: Primary Key - Mailing list pgsql-general

From Gregory Stark
Subject Re: Primary Key
Date
Msg-id 87lk8xvf8q.fsf@oxford.xeocode.com
Whole thread Raw
In response to Re: Primary Key  (Ron Johnson <ron.l.johnson@cox.net>)
Responses Re: Primary Key  (Ron Johnson <ron.l.johnson@cox.net>)
List pgsql-general
"Ron Johnson" <ron.l.johnson@cox.net> writes:

> On 11/16/07 12:50, João Paulo Zavanela wrote:
>> Hello,
>>
>> How many fields is recomended to create a primary key?
>> I'm thinking to create one with 6 fields, is much?
>
> The number of recommended fields is the *minimum* number required
> for uniqueness.  1 or 6 or 24.  Doesn't matter.

Unless of course you care about every other table being 24x larger and slower
due to having all these copies of the 24 fields. And of course unless you care
about being able to handle the inevitable day when it turns out the 24 fields
aren't unique and you need to consider adding a 25th column to the table *and
every table referencing it* as well as changing every line of application code
to use the new column.

--
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com
  Get trained by Bruce Momjian - ask me about EnterpriseDB's PostgreSQL training!

pgsql-general by date:

Previous
From: "Trevor Talbot"
Date:
Subject: Re: how should I do to disable the foreign key in postgres?
Next
From: Gregory Stark
Date:
Subject: Re: Variable LIMIT and OFFSET in SELECTs