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

Поиск
Список
Период
Сортировка
От Christophe Pettus
Тема Re: Am I supposed to be all scared of compound primary keys?
Дата
Msg-id EE3CEC87-A600-4532-83A2-FA5A5C3F302C@thebuild.com
обсуждение исходный текст
Ответ на Am I supposed to be all scared of compound primary keys?  (Mike Christensen <mike@kitchenpc.com>)
Список 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 по дате отправления:

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: Am I supposed to be all scared of compound primary keys?
Следующее
От: "justin@magwerks.com"
Дата:
Сообщение: Re: Am I supposed to be all scared of compound primary keys?