Agree with you Andy. My point was exactly that you should do a properly formed find statement (using containable behaviour or at least sensible recursion [shudder]) rather than a blanket read, which in my experience can often generate a huge array of stuff I don't need at the time.
Jeremy Burns Class Outfit Tel: +44 (0) 208 123 3822 Mob: +44 (0) 7973 481949 Skype: jeremy_burns http://www.classoutfit.com On 13 Oct 2011, at 12:39, AD7six wrote: > > > On Oct 13, 1:30 pm, Jeremy Burns | Class Outfit > <[email protected]> wrote: >> If you have a model with many associations, debug out the results of read() >> - and you'll be amazed at how much it pulls back. I never use it. > > Verging on FUD guys. > > https://github.com/cakephp/cakephp/blob/2.0/lib/Cake/Model/Model.php#L1412 > > There's no "performance" difference between using read and find first. > > cakii > > SELECT list, of, fields FROM foo WHERE id = 1 > > is better than > > SELECT list FROM foo WHERE id = 1 > SELECT of FROM foo WHERE id = 1 > SELECT fields FROM foo WHERE id = 1 > > Don't ask for fields you're not going to use - don't go back to the db > to get fields you "forgot" to ask for the first time. Use debug kit or > simply the query log and look at the sql you're generating - if you > don't change the recursive value of the model you might be generating > a lot more queries - or joins - than you expect/want. > > AD > > -- > 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
