JSON_DETAILED function (https://mariadb.com/kb/en/library/json_detailed/ ) is described as
We now got a use case for it: Optimizer Trace output. Optimizer trace is too large to be copied in full, instead we use expressions like
Our experience is that JSON_DETAILED has some room for improvement when it comes to the quality of automatic JSON formatting.
Things to note:
- empty lines at the start (right before/after the "range_scan_alternatives")
- "analyzing_index_merge_union": occupies 3 lines where one would be sufficient.
- the same goes for "ranges"
One can look at the JSON pretty-printer that is used by EXPLAIN FORMAT=JSON and optimizer trace. It produces a better result (but it has room for improvement, too.)
Extra: in MySQL, the function is called JSON_PRETTY. We should add ability to use this name as an alias.