On Mar 19, 4:45 pm, David Beckwith <[email protected]> wrote:
> Is this triple join asking for trouble? I mean is my server going to > hate me? language, region and job_types are going to have less than > 10 row entries, but job_type_preferences, language_preferences and > region_preferences will scale linearly with the number of users.... > In the absence of all other things they fewer joins the better but if they're needed to do the job then that's ok. Just be sure that you have indexes on those columns you join on and keep an eye on the explain output for that query. Fred > Model Load (0.7ms) SELECT `models`.* FROM `models` INNER JOIN > `job_type_preferences` ON (`models`.`id` = > `job_type_preferences`.`model_id`) INNER JOIN `job_types` ON > (`job_types`.`id` = `job_type_preferences`.`job_type_id`) INNER JOIN > `region_preferences` ON (`models`.`id` = > `region_preferences`.`model_id`) INNER JOIN `regions` ON > (`regions`.`id` = `region_preferences`.`region_id`) INNER JOIN > `language_preferences` ON (`models`.`id` = > `language_preferences`.`model_id`) INNER JOIN `languages` ON > (`languages`.`id` = `language_preferences`.`language_id`) WHERE > (weight_pounds <= NULL AND total_height_inches >= 60 AND minimum_pay > <= 2000 AND job_types.id = 4 AND regions.id = 1 AND languages.id in > (NULL)) AND ((`models`.`body_type_id` IN (4) AND > `models`.`skin_color_id` IN (4))) --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

