Re: Am I supposed to be all scared of compound primary keys? - Mailing list pgsql-general

From Christophe Pettus
Subject Re: Am I supposed to be all scared of compound primary keys?
Date
Msg-id EE3CEC87-A600-4532-83A2-FA5A5C3F302C@thebuild.com
Whole thread Raw
In response to Am I supposed to be all scared of compound primary keys?  (Mike Christensen <mike@kitchenpc.com>)
List pgsql-general
On May 1, 2010, at 7:25 PM, Mike Christensen wrote:

> \And I quote:
>
> Quick Note: Composite keys are highly discouraged. Use only when you
> have no other alternative.
>
> I get the feeling they're discouraged from a SQL point of view, but
> it doesn't actually say why anywhere.  Is there any good reason to
> avoid using composite keys on a table?  Why waste the space of an
> extra key if you don't have to?  Thanks!

A composite key is generally better than creating a surrogate key just
so you have a single-column key.  It's possible that the note is
referring to systems that handle composite keys poorly (PostgreSQL
handles them just fine), or are concerned about ORMs which don't
support them at all (like Django's) or support them badly.

--
-- Christophe Pettus
    xof@thebuild.com


pgsql-general by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: Am I supposed to be all scared of compound primary keys?
Next
From: "justin@magwerks.com"
Date:
Subject: Re: Am I supposed to be all scared of compound primary keys?