thanks for your reply i cant see though, what "containable" has to do with it with containable (what i use globally through app_model by default) you can narrow down the result but it is not the result i am worrying about
those classes above (and therefore as many objects?) are included anyway although there is no need for them whatsoever if i wouldnt use containable and set recursive on > 0 i would get all those user related infos as well. but then i would not bother about those included classes in my case they are no calls to these models - and they are not used in any query but i guess that is the problem here: cake prepares everything as if you want to containable or recursive can avoid the query, but they can't avoid that these files get included am i right? the problem is: some day there are almost 30 classes included which would not be neccessary this could make up as much as all those "actually needed" classes together - and therefore slows everything down. i guess your array / objects reason makes sense... maybe with pure PHP5 in 1.3 there will be some new approaches possible :) On 10 Aug., 15:43, Martin Westin <[email protected]> wrote: > I think you may be on a different level to that trac note. > > You would have to confirm the following but I believe this is > generally correct: > Cake does lazy loading of the classes... classes never referenced > during a request will not be included, loaded and instantiated. > Cake does no lazy loading of a Model's sql data, which is what would > be slowing things down as your database starts to fill up. > > PHP4 can partly be blamed, I guess. Cake chooses to return all Model > data as arrays... arrays can't magically load themselves on request as > objects can. The benefit of arrays (in PHP) is their simplicity and > wide support for array operations. > > Have you put Cake's Containable behaviour to use on your Models? > If you have, then should be fine. > > On Aug 10, 12:28 pm, "euromark (munich)" <[email protected]> > wrote: > > > hey guys > > i always though cake has (like yii) some build in lazy loading feature > > for the models not needed (although linked in the relation arrays (HM, > > HABTM etc) > > as stated here:https://trac.cakephp.org/wiki/notes/1.1.x.x > > > after wondering why my page got slower and slower on some views that > > didnt need most of the > 20 relations for the user model, i did some > > research > > > i found out that almost all models are still included and (probably) > > loaded/instantiated > > do i need to addiotionally patch the loading behaviour if i want to > > have the "real" lazy loading? meaning that the models are loaded only > > if really needed for data retrieval or functionatily? (and is this due > > to the fact that it still has to support php4?) > > > as you can see below, most of the models are not even used once in the > > queries or the functions called from controller/model > > > thx :) > > > "queries" (debug 0! no describes etc) log file: > > > SELECT `Poll`.`id`, `Poll`.`cat_id`, `Poll`.`user_id`, `Poll`.`name`, > > `Poll`.`descr`, `Poll`.`details_descr`, `Poll`.`layout`, > > `Poll`.`active`, `Poll`.`creator_info`, `Poll`.`allow_edit`, > > `Poll`.`allow_add`, `Poll`.`allow_access`, `Poll`.`allow_vote`, > > `Poll`.`allow_comments`, `Poll`.`multiple`, `Poll`.`result_details`, > > `Poll`.`result_show`, `Poll`.`result_type`, `Poll`.`start_date`, > > `Poll`.`end_date`, `Poll`.`notify`, `Poll`.`modified` FROM `tel_polls` > > AS `Poll` WHERE `Poll`.`user_id` = '1' ORDER BY `Poll`.`modified` DESC > > LIMIT 20 3 3 1 > > SELECT `PollOption`.`id`, `PollOption`.`active`, > > `PollOption`.`poll_id` FROM `tel_poll_options` AS `PollOption` WHERE > > `PollOption`.`poll_id` IN ('49c1c4c3-48a4-4359-8acf-0b1cdb7b895a', > > '49dad9cd-597c-45f1-aca3-09a8db7b895a', > > '49dab2c5-24bc-46c8-8d28-09a8db7b895a') 5 5 1 > > SELECT `PollVote`.`id`, `PollVote`.`poll_id` FROM `tel_poll_votes` AS > > `PollVote` WHERE `PollVote`.`poll_id` IN > > ('49c1c4c3-48a4-4359-8acf-0b1cdb7b895a', '49dad9cd-597c-45f1- > > aca3-09a8db7b895a', '49dab2c5-24bc-46c8-8d28-09a8db7b895a') 3 > > 3 1 > > SELECT `Document`.`id`, `Document`.`foreign_id` FROM `tel_documents` > > AS `Document` WHERE `Document`.`type` = 'polls' AND > > `Document`.`foreign_id` IN ('49c1c4c3-48a4-4359-8acf-0b1cdb7b895a', > > '49dad9cd-597c-45f1-aca3-09a8db7b895a', > > '49dab2c5-24bc-46c8-8d28-09a8db7b895a') 3 3 1 > > SELECT `Comment`.`id`, `Comment`.`foreign_id` FROM `tel_comments` AS > > `Comment` WHERE `Comment`.`type` = 'polls' AND `Comment`.`foreign_id` > > IN ('49c1c4c3-48a4-4359-8acf-0b1cdb7b895a', '49dad9cd-597c-45f1- > > aca3-09a8db7b895a', '49dab2c5-24bc-46c8-8d28-09a8db7b895a') 0 > > 0 1 > > SELECT `LogVisitor`.`id`, `LogVisitor`.`foreign_id` FROM > > `tel_log_visitors` AS `LogVisitor` WHERE `LogVisitor`.`type` = 'polls' > > AND `LogVisitor`.`foreign_id` IN > > ('49c1c4c3-48a4-4359-8acf-0b1cdb7b895a', '49dad9cd-597c-45f1- > > aca3-09a8db7b895a', '49dab2c5-24bc-46c8-8d28-09a8db7b895a') 1 > > 1 1 > > SELECT `Role`.`id`, `Role`.`name` FROM `tel_roles` AS `Role` WHERE 1 = > > 1 ORDER BY `Role`.`parent_id` DESC > > > "loading" log file: > > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\cake > > \libs\router.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\cake > > \libs\controller\component.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\cake > > \libs\overloadable.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\cake > > \libs\view\helper.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\cake > > \libs\class_registry.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\cake > > \libs\view\view.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\cake > > \libs\controller\controller.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\cake > > \dispatcher.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\tel > > \app_controller.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\tel > > \controllers\polls_controller.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\tel > > \controllers\components\session.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\tel > > \controllers\components\common.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\cake > > \libs\controller\components\request_handler.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\tel > > \controllers\components\auth.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\tel > > \controllers\components\auth_ext.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\tel > > \controllers\components\jquery.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\cake > > \libs\validation.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\cake > > \libs\model\behavior.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\cake > > \libs\model\connection_manager.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\cake > > \libs\model\model.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\tel > > \app_model.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\tel > > \models\poll.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\cake > > \libs\model\datasources\dbo\dbo_mysql.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\tel > > \models\user.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\tel > > \models\role.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\cake > > \libs\model\behaviors\containable.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\tel > > \models\address.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\tel > > \models\address_type.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\tel > > \models\location.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\tel > > \models\country_province.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\tel > > \models\country.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\tel > > \models\behaviors\multiple_display_fields.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\tel > > \models\behaviors\geocoder.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\tel > > \models\category.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\tel > > \models\date.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\tel > > \models\date_type.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\tel > > \models\email_address.php > > 2009-08-10 12:15:25 Load_1249899325: F:\PHP\xampp\htdocs\tel\p\tel > > \models\jabber.php --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
