- Categories:
SYSTEM$EXPLAIN_JSON_TO_TEXT¶
This function converts EXPLAIN output from JSON to formatted text.
- See also:
Syntax¶
Arguments¶
explain_output_in_json_formatA string, or an expression that evaluates to a string, containing EXPLAIN output as a JSON-compatible string. If the input is a string, the string should be enclosed in single quotes
'.
Returns¶
The function returns a VARCHAR containing the EXPLAIN output as text that has been formatted to be relatively easy for humans to read.
Usage notes¶
This function converts EXPLAIN information from JSON to formatted text. Often, the JSON value is produced directly or indirectly from the SYSTEM$EXPLAIN_PLAN_JSON function. For example, the output from SYSTEM$EXPLAIN_PLAN_JSON could be stored in a table, then displayed later using this SYSTEM$EXPLAIN_JSON_TO_TEXT function.
If a string literal is passed as input, the delimiter around the string can be either a single quote
'or a double dollar sign$$. If the string literal contains single quotes (and does not contain double dollar signs), then delimiting the string with double dollar signs avoids the need to escape the embedded single quote characters inside the string.
Examples¶
The example(s) below use these tables:
If you want to store the EXPLAIN output in JSON format, but display it as formatted text, you can call
SYSTEM$EXPLAIN_JSON_TO_TEXT() as shown below:
First, get EXPLAIN output in JSON format and store it in a table:
The JSON looks like the output shown below:
After you have stored the JSON in a table, you can pass the JSON to the SYSTEM$EXPLAIN_JSON_TO_TEXT function to convert it to a more human-readable text format by calling SYSTEM$EXPLAIN_JSON_TO_TEXT: