Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxxxxx


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux