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
   x...@thebuild.com


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

Reply via email to