Description:
The new EXPLAIN FORMAT=JSON is very nice. Many people might like to use that format all the time, without specifying the FORMAT=JSON option when they run EXPLAIN.
This is a feature request for a global/session variable `explain_format` with which one could configure JSON as the default format for all EXPLAIN statements.
How to repeat:
Run EXPLAIN. Wish to get JSON output, but don't specify the FORMAT=JSON option.
Observe that EXPLAIN always returns TRADITIONAL format when you don't specify the FORMAT option.
Suggested fix:
Implement a new config variable. I suggest the name `explain_format`.
The variable would support the same values supported by the EXPAIN FORMAT syntax: TRADITIONAL and JSON. If any new formats are implemented in the future, these should be supported by both the EXPLAIN FORMAT syntax and the config variable.
If the user tries to specify an unknown value for explain_format, the SET statement fails with an error: "ERROR 1231 (42000): Variable 'explain_format' can't be set to the value of '%s'" (similar to trying to set variables like binlog_format or log_output to an unknown value).
The variable would be global or session based. The session value would take priority over the global value, if they are different.
The variable would be dynamic.