On Saturday 25 February 2006 14:07, Ned Batchelder wrote:

> So there are SQL queries like this:
>
> SELECT field, field FROM app_model WHERE id = 50 ORDER BY date DESC
>
> Surely the ORDER BY clause can be omitted?  Is the magic-removal
> branch already fixing this?

Yep, the order by clause could be omitted.  However, in magic-removal 
(and I guess on trunk) the same mechanism is used to get single objects 
and multiple objects - for single objects you just filter on the value 
of the primary key.  So removing the ORDER BY would be more trouble 
than it's worth - you would have to add a special case for it (and the 
code to check for it might not be completely trivial), and it wouldn't 
have any effect on the results.  I can't imagine it would have much 
effect on performance either, but I don't know much about DB 
optimisation.  If you can show that it does affect performance on a 
popular DB then there would some motivation to change this.

Regards,

Luke

-- 
Parenthetical remarks (however relevant) are unnecessary

Luke Plant || L.Plant.98 (at) cantab.net || http://lukeplant.me.uk/

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to