I guess the first question is, do you really need to fetch all 750
rows at once? Second, do you need to have all of that associated data
(Color, Icon, etc.)? I can't think of why you would unless you're
creating a report (ie. CSV file) or generating a *really* long HTML
page.

If yo really must grab all that data with your Categories, you could
try using a finderQuery in the Category model for the $hasMany
association.

On Tue, Jul 10, 2012 at 3:03 PM, Christian <[email protected]> wrote:
> Hi there,
>
> I have the following find query:
>
>
>
>> $categoryItems_all = $this->Category->find('all', array('contain' =>
>> array('Productgroup' => array('Fee' => array('conditions' =>
>> array('Fee.country_id' => $this->__getCountryId()
>>
>> )
>>
>> ),
>>
>> 'Product' => array('Productoption' => array('Color',
>>
>> 'Material',
>>
>> 'Size',
>>
>> 'Icon',
>>
>> ),
>>
>> 'Vendor'
>>
>> )
>>
>> )
>>                                                                         ),
>>                                                     'conditions' =>
>> array('Category.parent_id' => $id,
>>
>> 'Category.active' => '1',
>>
>> 'Category.display' => '1'
>>
>> )
>>                                                     )
>>                                        );
>
>
> If I pack the same query in a flat SQL view, it has 750 rows (and takes same
> milii seconds). My Problem with the containable in find query is, that cake
> splits it up into ~10000!! queries which takes approximately 10 seconds and
> the database is not yet half filled with all items.
>
> Is there any alternative to use the containable behaviour which returns a
> similar result but with a better performance? As a workaround I'm currently
> using the view, but flat data was not was I was looking for. The "joins"
> options doesn't work either, since the result just contains the data of the
> model the find query was running on.
>
> Thanks,
> Christian
>
> --
> 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
> [email protected] 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
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to