From: | Gregory Stark <stark(at)enterprisedb(dot)com> |
---|---|
To: | "Ron Johnson" <ron(dot)l(dot)johnson(at)cox(dot)net> |
Cc: | "Grupo PostgreSQL" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Primary Key |
Date: | 2007-11-17 01:21:25 |
Message-ID: | 87lk8xvf8q.fsf@oxford.xeocode.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
"Ron Johnson" <ron(dot)l(dot)johnson(at)cox(dot)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!
From | Date | Subject | |
---|---|---|---|
Next Message | D. Dante Lorenso | 2007-11-17 01:29:54 | pg_dump not including custom CAST? |
Previous Message | Sam Mason | 2007-11-17 00:16:06 | Re: Primary Key |