MySQL Forums
Forum List  »  Performance

Re: how to force index usage with a small local dev database
Posted by: Raf Mahn
Date: February 18, 2018 04:26PM

OK, so the only way is to rewrite the query to use force index?

The problem is, as part of out integration test suite(in java) I have automated tests which intercept all the sql calls and does an explain to assert that all the select sqls are using an index. Im trying to catch queries that don't use an index before they get to production and become a problem.

Sometimes the index is not being used, this is because there is too little data in the table(mysql runs in docker as restarts every now and then). This causes our tests to fail sometimes which is annoying.

So when mysql doesn't use an index Im trying to figure out a way to force mysql to use the index as it would in our production environment. Then if an index is not used then I can fail the test.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: how to force index usage with a small local dev database
85
February 18, 2018 04:26PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.