Imagine a table where there are separate indexes on columns a
and b
.
The query runs somewhat like this:
SELECT col1, col2 FROM <table> WHERE a = 'value_1 AND b = 'value_2';
Now, does this query always use the indexes on both the columns? If so, what is the mechanism? And if not, is there any condition which MySQL checks to decide which index to use when more than one are available?