Re: MYSQL optimizer: Handling Subqueires
Posted by:
Rick James
Date: August 20, 2009 10:33AM
Others spend more time computing the optimal query plan, then freeze for all values. This is sub-optimal in situations where different plans work better for different values. I have seen as many as 6 different plans for a single query (varying the constants and the phase of the moon).
MySQL takes the approach that a fast optimizer that uses the constants in question is better than a thorough optimizer. I am almost always happy with MySQL's choice.
I believe MySQL's optimizer also notices what happens to be cached at the moment, picking an unobvious index.
The time taken for the subquery is not wasted since the result is used in the execution. And that subquery had to be performed anyway. The outer query may be better optimized because of having the result of the inner query.
Subject
Views
Written By
Posted
3318
August 17, 2009 05:50AM
2058
August 18, 2009 06:38PM
2117
August 19, 2009 03:33AM
2022
August 19, 2009 09:01PM
2020
August 20, 2009 09:34AM
Re: MYSQL optimizer: Handling Subqueires
2071
August 20, 2009 10:33AM
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.