MySQL Forums
Forum List  »  Optimizer & Parser

Re: Explain the order of query
Posted by: Jørgen Løland
Date: March 28, 2012 05:06AM

Hi Jongse,

From the information you have provided it's not possible to say in which order these tables are accessed/subqueries executed. The only thing that is certain is that T1 is accessed before T2 because of the relative order within the query block (i.e., same id=1).

Depending on the query, query blocks 2, 3 and 4 may be executed before T2 is joined with T1. Thus, not only "1-1-2-3-4" and "1-1-4-2-3" is possible, but maybe even "1-2-3-4-1" and all similar permutations.

I believe you have these choices at the moment:
* provide the information Rick has requested (SHOW CREATE TABLE, the query etc)
and thus give us an opportunity to answer
* download MySQL 5.6 and use optimizer tracing to see the actual execution order
* get a support deal and provide them with the info you have
* accept that you won't get an answer to this :-(

For optimizer tracing, see here

Hope this helps,
Jørgen Løland
Software Engineer, MySQL, Oracle

Options: ReplyQuote

Written By
March 19, 2012 01:49AM
March 19, 2012 10:38PM
March 21, 2012 07:06PM
March 22, 2012 06:01PM
March 22, 2012 08:13PM
March 23, 2012 07:57PM
Re: Explain the order of query
March 28, 2012 05:06AM

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.