Query Plan

Dataclass QueryPlan represents information about query plan returned by Snowflake REST API.

It is very similar to information you may see on query profile page in SnowSight.

  • get_running_step() - method which returns query step which is currently running

  • steps (List[QueryPlanStep])

    • step (int) - sequential number of step

    • description (str)

    • duration (float) - duration of step execution so far, in seconds

    • state (str) - internal state of step, different from query status and state

    • nodes (List[QueryPlanNode])

      • id (int) - internal ID of node

      • logical_id (int) - another ID of node, normally can be ignored

      • name (str) - node type, e.g. CartesianJoin

      • title (str) - additional title added to some node types

      • labels (Dict[str, QueryPlanLabel]) - labels specific for this node

        • name (str) - label name

        • value (Any) - label value, can be single value or List

      • waits (Dict[str, QueryPlanWait) - waits specific for this node

        • name (str)

        • value (float)

        • percentage (float)

      • statistics_io (Dict[str, QueryPlanStatistics]) - IO stats for specific node

        • name (str) - name of statistics

        • value (float) - value of statistics

        • unit (str) - unit of statistics (e.g. Bytes)

      • statistics_pruning (Dict[str, QueryPlanStatistics]) - pruning stats for specific node

        • name (str) - name of statistics

        • value (float) - value of statistics

        • unit (str) - unit of statistics (e.g. Bytes)

    • edges (List[QueryPlanEdge]) - edges represent connection between graph nodes

      • id (str) - ID of edge

      • src (int) - ID of source node

      • dst (int) - ID of destination node

      • rows (int) - number of rows passed from source node to destination node so far

      • expression (Any)

    • labels (Dict[str, QueryPlanLabel]) - labels specific for the whole query step

      • name (str) - label name

      • value (Any) - label value, can be single value or List

    • waits (Dict[str, QueryPlanWait) - waits specific for the whole query step

      • name (str)

      • value (float)

      • percentage (float)

    • statistics_io (Dict[str, QueryPlanStatistics]) - IO stats for the whole query step

      • name (str) - name of statistics

      • value (float) - value of statistics

      • unit (str) - unit of statistics (e.g. Bytes)

    • statistics_pruning (Dict[str, QueryPlanStatistics]) - pruning stats for the whole query step

      • name (str) - name of statistics

      • value (float) - value of statistics

      • unit (str) - unit of statistics (e.g. Bytes)

    • statistics_spilling (Dict[str, QueryPlanStatistics]) - spilling stats for the whole query step

      • name (str) - name of statistics

      • value (float) - value of statistics

      • unit (str) - unit of statistics (e.g. Bytes)

    • get_upstream_nodes(QueryPlanNode) - return list of all upstream nodes for specific node

    • get_downstream_nodes(QueryPlanNode) - return list of all downstream nodes for specific node

    • get_rows_between_nodes(QueryPlanNode, QueryPlanNode) - returns the amount of rows passed between pair of nodes, returns None if no rows were passed

Last updated