Add USE INDEX, FORCE INDEX capabilities to ORM
|Reported by:||Renato Alves||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||master|
|Severity:||Keywords:||INDEX USE FORCE|
|Cc:||clouserw@…, rkm, simon29||Triage Stage:||Design decision needed|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||yes||Patch needs improvement:||no|
Recently I've add significant performance issues with Django + MySQL.
The reasons behind this are MySQL not using an existing index due to low cardinality and instead do a full table scan. In most cases this is the correct choice but there some exceptions. For these, the workaround is to add "FORCE INDEX (index_name)" to the SQL.
However there is no support for this feature in the ORM.
As for the relevance of this functionality, in my case, query time was 0.09 sec when using FORCE INDEX and 10.3 sec when not.
This problem becomes more visible if the columns involved are used in several JOIN operations.
Change History (7)
comment:1 Changed 6 years ago by adamnelson
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:2 Changed 6 years ago by Alex
- Triage Stage changed from Unreviewed to Design decision needed
comment:4 Changed 5 years ago by russellm
- Resolution set to wontfix
- Status changed from new to closed
comment:5 Changed 5 years ago by simon29
- Cc rkm simon29 added
- Has patch set
- Needs tests set
- Resolution wontfix deleted
- Status changed from closed to reopened