I believe I’m nearly done with the SHOW
EXPLAIN feature. The idea is that if you’ve got some
long-running query $LONG_QUERY running in connection
$LONG_QUERY_CONN, you should be able to create another
connection, run SHOW EXPLAIN FOR
$LONG_QUERY_CONN and see what query plan is being used
to run the $LONG_QUERY.
How is this different from just running explain
$LONG_QUERY? First, you don’t need to replicate the exact
environment that $LONG_QUERY was run in: you don’t need to figure
out what values it had for @@optimizer_switch and
other settings, what were the contents of its temporary tables,
if any, what did InnoDB told the optimizer about the table
statistics, etc.
Another, indirect benefit is that we will now be able to produce query’s EXPLAIN at arbitrary point in time, which should make it possible to …
[Read more]