EXPLAIN
EXPLAIN compiles a statement and returns planning metadata without executing the generated query or applying the mutation.
Syntax
EXPLAIN [(metadata_options)] statement EXPLAIN [(metadata_options)] <following statements in the same multi-statement request>
When a statement follows EXPLAIN directly, only that statement is explained. Bare EXPLAIN is the multi-statement form used by tooling to explain the remaining request.
Options
The parenthesized option block is a comma-separated list of flags, key/value options, or option functions.
FIELDS(...)selects top-level fields such asSTAGE,OUTPUT_SCHEMA,FEATURES, andFINAL_NODES.FORMAT JSONrequests the structured JSON representation.MUTATION_DRY_RUNincludes the prospective effect of a supported registry mutation.
EXPLAIN (
FIELDS (STAGE, OUTPUT_SCHEMA, FEATURES)
)
RETURN
NET_REVENUE := GROSS_REVENUE - REFUNDS
FROM FM.SALES;
The ordinary result shape is one OUTPUT VARCHAR cell containing JSON. Unknown field names and options are rejected rather than silently ignored.
EXPLAIN can prefix another top-level statement, including CREATE, ALTER, or DROP, when that action supports dry-run planning.
See Statement tools and EXPLAIN for reading the output, and Feature metadata for mutation dry-run use cases.