The most important is that you only ask for what you need and make a good use of $conditions,$fields,$recursive,$limit and bindModel() unbindModel();
On May 29, 9:32 am, AD7six <[EMAIL PROTECTED]> wrote: > On 29 mayo, 09:10, "R. Rajesh Jeba Anbiah" > > > > <[EMAIL PROTECTED]> wrote: > > On May 28, 6:29 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:> On 5/28/07, > > R.RajeshJebaAnbiah<[EMAIL PROTECTED]> wrote: > > > > I'm getting so many queries in index action of controller, say for a > > > > typical blog project with categories, comments and tags, I'm getting > > > > so many queries in blogs/index which is having > > > > $this->Blog->recursive = 0; > > > > $this->set('blogs', $this->paginate()); > > > > This is normal behaviour, and is required for Cake's Models to do > > > their associative data mapping magic. > > > <snip> > > > FWIW, I do not question the need to run the queries. But, my > > question is that why it can't be optimized. With the better join > > query, we can have a single query that serves the purpose, instead of > > about 60 queries. > > Consider what would happen if you had some of your blogs are > associated with a large number (relative to your limit) of tags/ > categories/comments. You can't apply a limit to the number of > associated items, but also you can't even know how many results from > your primary table will be returned. > > hth, > > AD --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---