EXPLAIN

statementsupportedQueries & DML

docs.snowflake.com ↗

Returns the logical execution plan for the specified SQL statement. An explain plan shows the operations (for example, table scans and joins) that Snowflake would perform to execute the query.

Syntax

supportedpartialnot supportednot scored

EXPLAIN [ USING { TABULAR | JSON | TEXT } ] <statement>

Parameters

NameRequiredDescription
statementThis is the SQL statement for which you want the explain plan.
USING output_formatThis optional clause specifies the output format. The possible output formats are: JSON: JSON output is easier to store in a table and query. TABULAR: tabular output is generally more human-readable than JSON output. TEXT: formatted text output is generally more human-readable than JSON output. The default is TABULAR.

Usage notes

Output

The output contains the following information: Column | Description step | Most queries contain a single step, but some are executed as multiple distinct steps. This column denotes to which step the operation belongs. id | Unique identifier assigned to each operation in the query plan. parentOperators | Array of identifiers for the operation’s parent nodes. In the query profile, a parent is shown above its child with a link connecting the two. operation | Name of the operation, for example, Result, Filter, TableScan, Join, or CreateTableFromArchiveData. objects | Name of the object referenced by a table scan operation, for example, table, materialized view, secure view, or ARCHIVE OF <table>. alias | Alias of a referenced object, if the object has been given an alias in the query. expressions | List of expressions relevant to the current operation such as filters, join predicates, projections, aggregations, etc. partitionsTotal | The total number of micro-partitions in the referenced database object. partitionsAssigned | The number of partitions from the referenced object that are left after compile-time pruning, i.e. the number of partitions that might be scanned by the query. bytesAssigned | The number of bytes contained in the partitionsAssigned.

See also