Re: Am I supposed to be all scared of compound primary keys?

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Mike Christensen <mike(at)kitchenpc(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Am I supposed to be all scared of compound primary keys?
Date: 2010-05-02 02:32:12
Message-ID: q2hdcc563d11005011932xb521a89bl12d43b5d4482312e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, May 1, 2010 at 8:25 PM, Mike Christensen <mike(at)kitchenpc(dot)com> wrote:
> I have a table that stores a user ID and a subscription type, and this is
> really all it needs to store and any pair of values will always be unique.
> In fact, I think this pair should be the primary key on the table.  However,
> I'm using Castle ActiveRecord which says at:
>
> http://www.castleproject.org/activerecord/documentation/v1rc1/usersguide/pks.html#CompositePK
>
> 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!

From reading that, they're discouraged from a hibernate point of view.
I've never had a problem with composite keys in SQL myself.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Christophe Pettus 2010-05-02 02:35:46 Re: Am I supposed to be all scared of compound primary keys?
Previous Message Mike Christensen 2010-05-02 02:25:41 Am I supposed to be all scared of compound primary keys?