just stumbled upon Andy Dawson's OneQueryBehavior https://github.com/AD7six/mi/blob/master/models/behaviors/one_query.php
seems like the wheel already got invented ;) it looks quite promising and "optimized containable" not that unrealistic after all. I will have to check that one out some time. On 12 Nov., 18:41, euromark <dereurom...@googlemail.com> wrote: > well, I doubt that, too. > Especially with a lot of model relations you are usually better off > using recursive=-1 globally and defining contain everywhere. > > What troubles me more is the fact that containable is not optimized. > Or in other words: It creates up to 50x more queries than necessary > depending on the amount of joins in find(all) or paginate. > So the overhead using containable without custom bindModel is mainly > on the DB side, not the PHP side. > I tried to establish the grounds for a ticket. But I am not sure where > to begin. > It looks so easy to fix*, but I am sure it's probably not or creates > other problems. Otherwise they'd already covered the (in my opinion) > largest bottleneck remaining in 2.0. > > * checking on hasOne and belongsTo first and assigning custom > bindModel relations with foreignkey=>false and a conditions query > containing the appropriate keys. one left join instead of 100-200 > single queries + some additional ones for the hasMany relations etc. > > On 12 Nov., 14:40, Jeremy Burns | Class Outfit > > > > > > > > <jeremybu...@classoutfit.com> wrote: > > It'd be an interesting test, but from the outset I (unscientifically) doubt > > it. Without the contain behaviour and relying on recursive = whatever you > > are often pulling back way too much data, so some sort of model binding > > adjustment has to save horsepower. The containable behaviour simply manages > > the process of binding and unbinding, so I can't see how or why it'd be > > more inefficient than doing it yourself. I use it de facto and have not > > experienced any memory issues. Open to persuasion once I see some evidence > > though. > > > Jeremy Burns > > Class Outfit > > >http://www.classoutfit.com > > > On 12 Nov 2011, at 13:30, zuha wrote: > > > > I saw this comment on another thread, and instead of taking over that > > > thread with a containable discussion, I'm starting a new one. Can anyone > > > confirm or deny this claim that "containable" uses a lot of memory? (as > > > say compared to bind/unbind) > > > > On Sat, Nov 12, 2011 at 5:47 PM, phpMagpie <pa...@webbedit.co.uk> wrote: > > > I would advise you to learn how to use containable ... only takes a > > > couple of lines of code makes life a whole lot easier than having to > > > bind and unbind for every paginate. > > > > I'd like to avoid it. I think it consumes a lot of memory. CMIIW. > > > Thank you. > > > > -- > > > Our newest site for the community: CakePHP Video > > > Tutorialshttp://tv.cakephp.org > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp > > > others with their CakePHP related questions. > > > > To unsubscribe from this group, send email to > > > cake-php+unsubscr...@googlegroups.com For more options, visit this group > > > athttp://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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php