SYSTEM$EXPLAIN_PLAN_JSON

functionsupportedQueries & DML

docs.snowflake.com ↗

System functions

Given the text of a SQL statement, this function generates the EXPLAIN plan in JSON.

Syntax

SYSTEM$EXPLAIN_PLAN_JSON( { <sql_statement_expression> | <sql_query_id_expression> } )

Parameters

NameRequiredDescription
sql_statement_expressionrequiredA string, or an expression that evaluates to a string, containing the SQL statement for which you want the EXPLAIN plan. If a literal string is used, it should be surrounded by single quote characters '.
sql_query_id_expressionrequiredA string, or an expression that evaluates to a string, containing the query ID for which you want the EXPLAIN plan. If a literal string is used, it should be surrounded by single quote characters '. Snowflake retains historical data for query IDs executed within the previous 14 days. If you specify the query ID for a query executed more than 14 days in the past, an error is returned. For more information, see Monitor query activity with Query History.

Returns

The function returns a VARCHAR containing the EXPLAIN output in JSON-compatible format.

Usage notes

See also

Referenced by