On Mon, Sep 20, 2010 at 1:25 PM, paulocl <[email protected]> wrote:
> I using a CakePHP with a database like this:
>
> Estudant
>  |
> Test
>  |
> Question
>
> I create the three models. When I execute a find('all',
> array(recursive => 3)) the sql select executed in database not uses
> any join.
> First is executed "select (fields) from estudants", then is executed
> one "select (fields) from tests where id = *" where * is the test
> foreing key in estudants and then execute ond "select (fields) from
> questions where id = *" for all question foreing key in tests.
>
> There is a way to CakePHP execute this with only one sql using inner
> join? Because the sql above cause poor performance.
>
> I try to return a model find with recursive =>5 returning 1 register
> "find('all', array('recursive' => 5, 'limit' => 1));" because the
> complex relationship and the find return in 21 seconds for 1 register.

See here:
 http://nuts-and-bolts-of-cakephp.com/2008/07/17/forcing-an-sql-join-in-cakephp/

> P.S.: Sorry for my bad english

No need to apologise. Your english is better than some native speakers.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" 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

Reply via email to