In other words, how does MySQL find the result range with indexes on the first step when it's executing a select query?
migrated from stackoverflow.com Mar 4 at 3:44
This question came from our site for professional and enthusiast programmers.
That is really the job of the MySQL Query Optimiser. You can determine more information by evaluating the results of EXPLAIN.
You can also manually tweak the Query Optimiser by forcing or hinting an index, or changing the optimizer_search_depth variable which will tell the Query Optimiser how far in the future of each incomplete plan the optimizer should look to evaluate whether it should be expanded.