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

Reply via email to