A a new tracing capability has been added to the MySQL optimizer with 5.6.3. Optimizer Tracing goes beyond EXPLAIN EXTENDED to show how the optimizer treats queries. The demonstration of this feature at Oracle Open World had several noted DBAs speechless.
SET optimizer_trace="enabled=on";
SELECT Name FROM City WHERE ID=999;
SELECT trace into dumpfile '/tmp/foo' FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
And the trace follows (sadly WordPress kills the indentations, PDF of trace here)
{
"steps": [
{
"join_preparation": {
"select#": 1,