Description:
EXPLAIN statement in general allows to use FORMAT=JSON to produce easy to0 parse JSON format:
mysql> explain format=json select 1 from dual\G
*************************** 1. row ***************************
EXPLAIN: {
"query_block": {
"select_id": 1,
"message": "No tables used"
}
}
1 row in set, 1 warning (0,02 sec)
But if we try to use EXPLAIN ANALYZE, it does not work:
mysql> explain analyze format=json select 1 from dual\G
ERROR 1235 (42000): This version of MySQL doesn't yet support 'FORMAT=JSON with EXPLAIN ANALYZE'
All we have is TREE format (used also by default) that is easy to read,m but hard to parse in the code:
mysql> explain analyze format=tree select 1 from dual\G
*************************** 1. row ***************************
EXPLAIN: -> Rows fetched before execution (cost=0.00..0.00 rows=1) (actual time=0.000..0.001 rows=1 loops=1)
1 row in set (0,00 sec)
How to repeat:
Run:
explain analyze fromat=json <any SQL here>;
and check the output.
Suggested fix:
Do it like some other RDBMSes with EXPLAIN ANALYZE feature:
https://www.postgresql.org/docs/9.1/sql-explain.html
and support JSON and maybe other structured formats.