MYSQL optimizer: Handling Subqueires
Hi,
I wanted to know the handling of subquery conditions in the WHERE clause. The order of rows in EXPLAIN statement shows the plan for the main select first and then that of the sub-selects.
I had two questions regarding this:
1.) Whenevr a subquery is used, does it affect the table access plan and the cardinality estimation for the table in the outer select on which this subquery condition applies.
For example, in the following query
select colum1
from
t1,t2
where
t1.attribname=t2.attribname
and
t1.attribname<= (select t1.attribname from t1 where t1.attribname< constant value)
does the subquery condition for t1 affect its cardinality estimation and/or table access plan? As such, seeing the EXPLAIN output for such queries, I feel it's not affecting.
2.) If not, how the subqueries are handled by optimizer? Are they planned independently from the outer query? And if this istrue, does it mean that the outer query planning does not take subquery conditions into consideration for optimization?
Subject
Views
Written By
Posted
MYSQL optimizer: Handling Subqueires
3318
August 17, 2009 05:50AM
2058
August 18, 2009 06:38PM
2117
August 19, 2009 03:33AM
2023
August 19, 2009 09:01PM
2022
August 20, 2009 09:34AM
2074
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.