Bug #29956 Explain should optionally execute the query and return the execution path
Submitted: 22 Jul 2007 11:48 Modified: 22 Jul 2007 15:40
Reporter: Parvesh Garg Email Updates:
Status: Won't fix Impact on me:
Category:MySQL Server: Optimizer Severity:S4 (Feature request)
Version:All OS:Any
Assigned to: CPU Architecture:Any
Tags: explain, feature

[22 Jul 2007 11:48] Parvesh Garg

It would be nice to have EXPLAIN actually executing the query and then tell the execution path taken by the query. As sometimes, though very rare, output of EXPLAIN does not match the actual path, it would be nice to have MySQL having real hands on the query.

This will be a little tricky as for queries like INSERT, DELETE etc that change the data, but those can either be barred or left at the user's choice.

How to repeat:

Suggested fix:
AFAIK, this would need support from the underlying database engine to return back the execution path. I'm sorry if it is not so. 

Some option like EXPLAIN EXECUTE should do. Also it can be used with the statements itself like SELECT EXPLAIN or INSERT EXPLAIN, this way it would be better as it more intuitive that the query is actually going to execute.
[22 Jul 2007 15:40] Valeriy Kravchuk
Thank you for a feature request. I do not agree with it, though. EXPLAIN should show the plan for (all, including INSERT etc) queries, but NOT excute them. 

What is needed is the way to capture and then show actual plan used for the query, like sql_trace setting in Oracle does, for example. But this is another story.