Re: Avoiding surrogate keys

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: Thom Brown <thombrown(at)gmail(dot)com>, PGSQL Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Avoiding surrogate keys
Date: 2010-04-21 19:25:16
Message-ID: 1271877916.2857.2.camel@jd-desktop.unknown.charter.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 2010-04-21 at 15:18 -0400, Merlin Moncure wrote:

> Natural keys:
> *) force formal relationships into your key design (this is good)
> *) Make your database MUCH easier to follow, browse, and understand
> *) in particular cases allow you to skip joins
> *) will make your indexes fatter (this is not good)
> *) can be a pain if your keys are updated frequently
> *) can be a major pain if your key changes in structure (adds a field,
> or changes in type)
>
> Surrogate keys:
> *) Give you faster joins, but more of them (this is a win/loss
> depending on circumstances)

Kind of... natural keys can remove the need for the join in the first
place, which is certainly faster than joining :P

Joshua D. Drake

--
PostgreSQL.org Major Contributor
Command Prompt, Inc: http://www.commandprompt.com/ - 503.667.4564
Consulting, Training, Support, Custom Development, Engineering

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thom Brown 2010-04-21 19:30:44 Re: Avoiding surrogate keys
Previous Message Merlin Moncure 2010-04-21 19:18:00 Re: Avoiding surrogate keys