v.21.6New Feature
Add JSON Output Setting for EXPLAIN PLAN Query
Add settingjson(boolean, 0 by default) forEXPLAIN PLANquery. When enabled, query output will be a singleJSONrow. It is recommended to useTSVRawformat to avoid unnecessary escaping. #23082 (Nikolai Kochetov).
Why it matters
This feature allows users to get theEXPLAIN PLAN output in a structured JSON format, which can be easier to parse programmatically and integrate with external tools or systems. It addresses the need for a machine-readable format of query plans and improves usability for automation and analysis.How to use it
To enable this feature, set thejson setting to 1 before running EXPLAIN PLAN. It is recommended to use the TSVRaw output format to avoid unnecessary escaping of the JSON output. Example usage:SET json = 1;
EXPLAIN PLAN
SELECT * FROM table;