MySQL Forums
Forum List  »  Optimizer & Parser

Re: Dependent subquery stupidity: Is it me or the optimizer? ;-)
Posted by: KimSeong Loh
Date: March 09, 2006 02:50AM

If I am not wrong, in the 2nd query with the o1.i = 50, the inner subquery can be reduced into an independant subquery after o1.i is replaced with the constant 50 and only need to be executed once and obtain the value (result of the inner query) which is constant throughout all the rows in the outer query (that matches o1.i = 50).

In query 3, the value of o1.i could change for each rows in the outer query, so need to execute the inner query once for every row in the outer query.

Options: ReplyQuote

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.