1

I have a query which gets different query plans over time and one of them takes less then a minute to execute, the other one takes days. Can I tell the db to use a given plan (taken from explain or using inline instructions) so that the good plan is always used or at least the catastrophical one gets always avoided? The good plan has only ref joins while the bad one also has index and eq_ref and a different ordering.

1

There are al lot of passibilities to force mariadb

for example:

  • Forcing Join Order
  • Forcing Usage of a Specific Index for the WHERE Clause
  • USE INDEX: Use a Limited Set of Indexes
  • IGNORE INDEX: Don't Use a Particular Index
  • FORCE INDEX: Forcing an Index

how they work and how to use it

https://mariadb.com/kb/en/index-hints-how-to-force-query-plans/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.