v.21.6New Feature

Add JSON Output Setting for EXPLAIN PLAN Query

Add setting json (boolean, 0 by default) for EXPLAIN PLAN query. When enabled, query output will be a single JSON row. It is recommended to use TSVRaw format to avoid unnecessary escaping. #23082 (Nikolai Kochetov).
Added a new boolean setting json for the EXPLAIN PLAN query that, when enabled, outputs the query plan as a single JSON row.

Why it matters

This feature allows users to get the EXPLAIN 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 the json 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;