#7231: New "join" parameter for the "extra" QuerySet method
---------------------------------------------------+------------------------
          Reporter:  Davide "Design" Muzzarelli    |         Owner:  nobody     
             
            Status:  closed                        |     Milestone:             
             
         Component:  Database layer (models, ORM)  |       Version:  SVN        
             
        Resolution:  wontfix                       |      Keywords:  queryset 
extra left join
             Stage:  Design decision needed        |     Has_patch:  1          
             
        Needs_docs:  1                             |   Needs_tests:  1          
             
Needs_better_patch:  1                             |  
---------------------------------------------------+------------------------
Comment (by jonozzz):

 I have to disagree with russellm about this patch. Sometimes raw queries
 are not reliable and even harder to maintain.
 The extra() covers almost every piece of a query EXCEPT for the join piece
 and I believe this patch completes it.

 In my case I had to replace the auto-generated sub-query
 SELECT...IN(SELECT...) with a INNER JOIN. By doing this my query improved
 100x times on a really small, non-production, database.

 Maybe if Django would've optimized the sub-query generation when using the
 'in' lookup I wouldn't have needed this.
 I looked at creating a custom aggregate, but that's just a pain in the ass
 and I think there's more work to be done in this area.

 Thanks for the patch.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/7231#comment:13>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" 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/django-updates?hl=en.

Reply via email to