Allow defining order of column for indexes
|Reported by:||anonymous||Owned by:||akki|
|Component:||Database layer (models, ORM)||Version:||master|
|Severity:||Normal||Keywords:||index, order, db-indexes|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Description (last modified by timgraham)
Currently the index_together tuples do not support index ordering using + / -.
If I have the following table:
class Messages: user_id, rating, last_update, index_together=[ ['user_id', 'rating', 'last_update',] # sorted ASC by default ]
So for MySQL, the following query cannot make use of the index:
Pardon me if it actually can make use of the index.
I know there are workarounds, such as negating values to make a DESC ordering become ASC ordering.
But it is just nice to have such a feature.
Btw, what is the reason for not having this feature?
Change History (15)
comment:1 Changed 3 years ago by wim@…
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:3 Changed 3 years ago by animan1
- Owner changed from nobody to animan1
- Status changed from new to assigned
comment:5 Changed 3 years ago by anonymous
- Easy pickings set
- Owner animan1 deleted
- Status changed from assigned to new
comment:11 Changed 4 weeks ago by akki
- Has patch set
comment:12 Changed 3 weeks ago by timgraham
- Summary changed from Index ordering in index_together and unique_together to Index ordering in index_together
comment:14 Changed 2 weeks ago by Tim Graham <timograham@…>
- Resolution set to fixed
- Status changed from assigned to closed