Bug #70712 Config variable explain_format
Submitted: 23 Oct 2013 18:28 Modified: 30 Nov 2013 7:05
Reporter: Bill Karwin (Candidate Quality Contributor) (OCA) Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: Options Severity:S4 (Feature request)
Version:5.6.14 OS:Any
Assigned to: Gleb Shchepa CPU Architecture:Any
Tags: explain

[23 Oct 2013 18:28] Bill Karwin
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.
[30 Nov 2013 7:05] MySQL Verification Team
Hello Bill,

Thank you for the feature request!