MySQL Forums
Forum List  »  Optimizer & Parser

Re: Optimizer - subqueries
Posted by: Felix Geerinckx
Date: November 02, 2005 03:52AM

Jake Day wrote:

> The explain shows that the query is running the "outer" part first, and then the subquery. I want
> it to run the subquery first.

I believe this is (at present) a limitation of the subquery optimizer. The subquery is probably also listed as "DEPENDENT SUBQUERY" where in fact it isn't.

> If anyone can advise how to get the subquery to run first it would be most apppreciated.

Depending on your actual data, the LEFT JOIN version:

SELECT
a.*, b.*
FROM (header a
JOIN detail b ON a.id = b.id)
LEFT JOIN c ON a.id = c.id
WHERE
c.id IS NOT NULL;

might pick c as the driving table.

--
felix
Please use BBCode to format your messages in this forum.

Options: ReplyQuote


Subject
Views
Written By
Posted
4338
November 01, 2005 09:59AM
Re: Optimizer - subqueries
2356
November 02, 2005 03:52AM
2250
November 02, 2005 08:50AM


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.