Verify that you have an index on parent_id column in categories table
(as well as a separate index on the id column). ContainableBehavior
usually tries to generate a LEFT JOIN with the belongsTo and the
hasOne related tables, so without the proper indexes, the database may
be resorting to an n x n table scan. Without any details of how you
separated the single containable query into separate queries, I would
guess that by doing so, you pretty much forced it to do only two table
scans on the categories table (once for all categories, the second for
all the unique parent categories).
On Feb 27, 11:10 pm, TimG <t...@gurske.com> wrote:
> It looks like it's just the way it is. Because of the way the
> associations are it has to query each variation. I just removed the
> variations from the containable and queried them separately and then
> combined the arrays in PHP. Much quicker now.
>
> Thanks for everybody's help!
--
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:
Post a Comment