EXPLAIN

You can prepend any SELECT statement with the keyword EXPLAIN to display the physical plan that is used during the execution.

Syntax

EXPLAIN query

Parameters

query

The query to explain.

Returns

  • PLAN

    A textual representation of the plan

  • PLAN_HASH

    A hash that allows to quickly disambiguate between two plans

  • PLAN_DOT

    A dot representation of the plan

  • PLAN_GML

    A Graph Modelling Language (GML) representation of the plan

  • PLAN_CONTINUATION

    A byte array that contains information that is essential in the context of plan serialization

Examples

TODO change examples to render dot graph and put actual plan hash

Table scan

EXPLAIN SELECT name FROM restaurant WHERE rest_no >= 44;

PLAN

PLAN_HASH

PLAN_DOT

PLAN_GML

PLAN_CONTINUATION

SCAN(<,>)
| TFILTER RestaurantComplexRecord
| FILTER _.rest_no GREATER_THAN_OR_EQUALS 42
| MAP (_.name AS name)

-1635569052

dot_graph

gml_graph

continuation

Index scan

EXPLAIN
    SELECT name
    FROM RestaurantComplexRecord USE INDEX (record_name_idx)
    WHERE rest_no > 10

PLAN

PLAN_HASH

PLAN_DOT

PLAN_GML

PLAN_CONTINUATION

COVERING(record_name_idx <,> -> [name: KEY[1], rest_no: KEY[2]])
| FILTER _.rest_no GREATER_THAN 10
| MAP (_.name AS name)

-1543467542

dot_graph

gml_graph

continuation

EXPLAIN
    SELECT *
    FROM RestaurantComplexRecord AS R
    WHERE EXISTS (SELECT * FROM R.reviews AS RE WHERE RE.rating >= 9)

PLAN

PLAN_HASH

PLAN_DOT

PLAN_GML

PLAN_CONTINUATION

ISCAN(mv1 [[9],>)
| MAP (_.0 AS rest_no, _.1 AS name, _.2 AS location, _.3 AS reviews, _.4 AS tags, _.5 AS customer, _.6 AS encoded_bytes)

-8677659052

dot_graph

gml_graph

continuation