What I mean is: 1. fetching sub-objects which are declared as ForeignKey(null=True). ForeignKey(null=False) sub-objects are already fetched by select_related(). 2. fetching sub-objects declared as ManyToManyField() in a principal object. These objects are not fetched by select_related().
One often iterates over these sub-objects, or as least, I do, and that spawns a lot of sub-queries per object, which in turn creates performance issues. Pre-fetching these nested sub-objects would alleviate my, but I guess also other people's performance problem. And I'll keep away from custom SQL. JJ. On Jul 17, 11:17 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Tue, 2007-07-17 at 02:11 -0700, jj wrote: > > Thanks Malcom. Will your rewrite make it possible to easily fetch > > ForeignKey(null=True) and M2M sub-objects? That would solve my > > (performance) problem. > > If by ForeignKey(null=True), you mean all objects that don't have any > related objects attached, then the answer is yes, although I'm not sure > how we'll spell that yet (a very minor point). Some discussion needed > there. > > Not sure what you mean by the second one, but if there's an existing > ticket for it, it will be looked at, if not it will be easier in future > development in any case. > > Regards, > Malcolm > > -- > Many are called, few volunteer.http://www.pointy-stick.com/blog/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---