True.. Although.. if i were to display 10 users on my front page, cake needs 31 queries.. all that can be done with just one query. Not to mention that i also have a "Photos" table.. that ads 10 more queries. So 41 vs. 1.. that is quite a big difference :)
I think i'll try to use some hacks in a custom controller.. like maybe after the findAll on the user table collect the id's of all countries and photos and use that to query the database. On Mar 7, 11:36 pm, Langdon Stevenson <[EMAIL PROTECTED]> wrote: > If you just want one big query, then you will need to code it yourself > and use $this->Profile->query() to run it. > > Multiple queries is the price you pay for Cake's automation of > relationships. If you are worried about this for performance reasons, > then I would suggest that you do some bench marks. Work out how much > each approach differs, then decide if its worth bothering with. > > To me, one of the biggest benefits of using Cake is that I don't have to > maintain mountains of SQL code. For that price I will gladly pay for > some extra server horse power if required. > > Just my personal opinion of course. > > Regards, > Langdon > > > The problem is that when i do a findAll on the Users, it first runs a > > query that selects Users with left joined Profiles, then it runs a > > query for each Profile, and then one query for each Country in each > > Profile. > > So to select 2 Users it uses 5 queries. > > I would like to have one big query... or at least avoid the query that > > selectes the Profile since that is already selected in the Users query > > (with joins) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
