Monday, January 31, 2011

Re: Containable Query Slow - Am I doing it wrong?

Looks alright. What are the indexes and relationships like on the db?

Jeremy Burns
Class Outfit

jeremyburns@classoutfit.com
http://www.classoutfit.com

On 31 Jan 2011, at 17:23, TimG wrote:

> Hey,
> This code below works well but the query is really slow. It adds five
> seconds more to the page request time. Am I doing something wrong or
> is it just the way it is? Also, is there a way to do this with a
> custom query and would it be any quicker? Thanks in advance!
>
> $this->Category->Behaviors->attach('Containable');
> $tempCategories = $this->Category->find('all', array(
> 'fields' => array('id','title','description','order'),
> 'order' => array("Parent.title" => "asc","Category.order" => "asc"),
> 'contain'=>array(
> 'Parent' => array('fields' => array('id','title','description')),
> 'Product' => array('fields' => array('id','title','description'),
> 'conditions' => array('active'=>1),
> 'Variation' => array('fields' => array('id','title','price'))
> ))));
>
> --
> Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: