2

I'm using django orm and mysql. From some reason mysql is using the wrong index. I want to manually override the index used. I saw that the django team decided from cross platform reason to prevent usage of with_hints extension that would force an index. Does anyone have any kind if solution \ proposal how I could get mysql to use the correct index then through django?

Thanks

2 Answers 2

3

The django-mysql extension supports indexing hints. See the docs for details.

Sign up to request clarification or add additional context in comments.

2 Comments

If you recommend a library, please show how it can be applied.
I used force_index
1

Django supports raw sql queries to fit your needs, see the documentation article Performing raw SQL queries.

When the model query APIs don’t go far enough, you can fall back to writing raw SQL. Django gives you two ways of performing raw SQL queries: you can use Manager.raw() to perform raw queries and return model instances, or you can avoid the model layer entirely and execute custom SQL directly.

2 Comments

I'm using tastypie so I'm not sure how go about editing the mysql query directly. Do you know by any chance?
No, sorry. Never used tastypie.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.