#26225: Coalesce Multiple Calls to order_by with Same Arguments
-------------------------------------+-------------------------------------
Reporter: cancan101 | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Database layer | Version: 1.9
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by jarshwah):
I agree with Marc. Too complex for very little gain. Imagine the case
where you have multiple complex ordering expressions:
{{{
qs.order_by(Upper('field_a').asc(), Lower('field_b').desc(),
Concat(F('field_c'), F('field_d')).asc())
}}}
If another ordering queryset method is applied, to determine if that was
"the same" as last time, you could only really do identity checks which
fails unless the objects are reused, or to generate what the ordering sql
would be, and comparing that against the existing. Neither of those
options are fool proof, and generating the sql would be fairly expensive
for very little gain.
--
Ticket URL: <https://code.djangoproject.com/ticket/26225#comment:3>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/067.c8a9109b2022b2c7cdcc17e3ffbdb099%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.