Re: Surrogate VS natural keys

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
Cc: Rich Shepard <rshepard(at)appl-ecosys(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Surrogate VS natural keys
Date: 2007-06-20 16:28:15
Message-ID: 4679559F.6080707@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Richard Broersma Jr wrote:
> --- "Joshua D. Drake" <jd(at)commandprompt(dot)com> wrote:
>> The value of a surrogate key is easy retrieval and really has nothing to
>> do with normalization or proper modeling.
>>
>> I often add a surrogate key, even when one is not required just so I
>> don't have to worry about have a 4 element where clause.
>
>
> I've often wondered about this. Since PostgreSQL allows FOREIGN KEYS to be referenced from UNIQUE
> (non-primary) natural keys, couldn't the schema be designed so that every table has a surrogate
> PRIMARY KEY and yet still maintain the relationships using UNIQUE natural keys.
>
> Would a design like this be practical?

I would do it the other way. Have your primary keys be natural.

Joshua D. Drake

>
> Regards,
> Richard Broersma Jr.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
>

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
PostgreSQL Replication: http://www.commandprompt.com/products/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pedro Doria Meunier 2007-06-20 17:18:23 Re: Problem editing tables (geom columns)
Previous Message Richard Broersma Jr 2007-06-20 16:18:30 Re: Surrogate VS natural keys