Another thing to keep in mind is that you can access all your models
through their relations.
so $this->model->relatedModel->anotherRelatedModel->find('all')
will work. Cake will build all the related models for the models in
$uses, so you can access them through relations if you don't need them
at $this->model.
Personally, I find uses most useful for loading models that would be
inaccessible with relations.
-Mark
On Oct 12, 1:04 am, Bo Huang <[EMAIL PROTECTED]> wrote:
> Thanks a lot, Larry and David.
>
>
>
> David C. Zentgraf wrote:
>
> > Yes, the more models you use, the more overhead there is. Not only in
> > terms of database hits, but simply the fact that an additional class
> > needs to be included and loaded. So design your database and models
> > wisely from the start.
>
> > Having said that, this overhead is often negligible, except for truly
> > performance hungry apps. If you have such a performance hungry app,
> > think about conditionally loading models with App::import.
> > Also, as soon as you go to debug mode 0, the models will be cached and
> > not DESCRIBED every single time. (What Larry said.)
>
> > On 12 Oct 2008, at 11:42, [EMAIL PROTECTED] wrote:
>
> >> Hi there,
>
> >> My controller includes eight models as follows,
> >> var $uses = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H');
>
> >> When loading a view for the controller, it always DESCRIBE the above
> >> eight TABLES (models) even the action (view) has nothing to do with
> >> these tables. From the cakephp log on view, it is a big performance
> >> hit for me.
>
> >> Q:
> >> 1. is this by design?
> >> 2. how to reduce these queries?
>
> >> I didn't get much helpful info from internet and cakephp official
> >> site. I'd appreciate it if any help (or article link).
>
> >> Thanks,
> >> Bo
>
> --
> View this message in
> context:http://n2.nabble.com/In-controller-using-too-many-models-hit-the-perf...
> Sent from the CakePHP mailing list archive at Nabble.com.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---