Have been looking into using rails but am finding the "Composite Primary Keys are Bad" thing a tad disturbing (to put it mildly). I have been working with RDBMS systems for over fifteen years and this is the first time I have herd the idea questioned. I have cone across using surrogate keys which mirror the composite key for performance reasons in VERY big databases but I have never herd the idea questioned from a logical database design point of view. Apart from it being easier in rails to use non composite keys has anyone got any other good reasons not to use them. As far as I am concerned they are fundamental to RDBMS. Regards, Ben -- Ben Edwards - Brussels, Belgium & Bristol, UK If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ben Edwards wrote:> Have been looking into using rails but am finding the "Composite > Primary Keys are Bad" thing a tad disturbing (to put it mildly). I > have been working with RDBMS systems for over fifteen years and this > is the first time I have herd the idea questioned. I have cone across > using surrogate keys which mirror the composite key for performance > reasons in VERY big databases but I have never herd the idea > questioned from a logical database design point of view. Apart from > it being easier in rails to use non composite keys has anyone got any > other good reasons not to use them. As far as I am concerned they are > fundamental to RDBMS.They are fundamental to RDBMSes. The problem is that they don''t map so well from the relational world to the object world so ORMs have to go through convolutions to handle them. That''s why if you are creating a "green field" application the recommendation is to use a single column as the unique key. This problem is not unique to ActiveRecord. If you look at something Hibernate, it does support composite primary keys but you have to define your own "equality" method, even after you specify what columns make up the composite key. -- Michael Wang --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ben Edwards wrote:> Have been looking into using rails but am finding the "Composite > Primary Keys are Bad" thing a tad disturbing (to put it mildly). I > have been working with RDBMS systems for over fifteen years and this > is the first time I have herd the idea questioned. I have cone across > using surrogate keys which mirror the composite key for performance > reasons in VERY big databases but I have never herd the idea > questioned from a logical database design point of view. Apart from > it being easier in rails to use non composite keys has anyone got any > other good reasons not to use them. As far as I am concerned they are > fundamental to RDBMS.Ben, you can use composite primary keys in Rails. See http://compositekeys.rubyforge.org/ -- Sava Chankov --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---