0

It's been a long day, but I've been wresting with a query which wont use an index, and thus takes much longer than it should. I stumbled upon USE INDEX FOR JOIN, but it didn't improve anything.

Then I reverted it back to the original query.

Now it's decided to use that index, instead of the previous full table scan and it's down from 17s to 1s.

Did I "convince" the query planner to use the index with USE INDEX FOR JOIN?

  • 1
    Without any query or table structure or EXPLAIN {query} this question isn't not worth asking. INDEX forcing should only happen in extreme and temporary cases. – danblack Jan 25 at 0:24
  • could just be a changing of samples hit the right spot. No reason it couldn't revert. Details required. suggested reading – danblack Jan 25 at 4:48
  • Now it's decided to use that index The table statistic refreshes. Next time simply execute ANALYZE TABLE. – Akina Jan 25 at 5:04

Your Answer

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

Browse other questions tagged or ask your own question.