EXPLAIN¶
You can prepend any SELECT statement with the keyword EXPLAIN to display the physical plan that is used during the execution.
Syntax¶
Parameters¶
queryThe query to explain.
Returns¶
PLANA textual representation of the plan
PLAN_HASHA hash that allows to quickly disambiguate between two plans
PLAN_DOTA dot representation of the plan
PLAN_GMLA Graph Modelling Language (GML) representation of the plan
PLAN_CONTINUATIONA 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;
|
|
|
|
|
|---|---|---|---|---|
SCAN(<,>)
| TFILTER RestaurantComplexRecord
| FILTER _.rest_no GREATER_THAN_OR_EQUALS 42
| MAP (_.name AS name)
|
|
dot_graph |
gml_graph |
continuation |
Index scan¶
EXPLAIN
SELECT name
FROM RestaurantComplexRecord USE INDEX (record_name_idx)
WHERE rest_no > 10
|
|
|
|
|
|---|---|---|---|---|
COVERING(record_name_idx <,> -> [name: KEY[1], rest_no: KEY[2]])
| FILTER _.rest_no GREATER_THAN 10
| MAP (_.name AS name)
|
|
dot_graph |
gml_graph |
continuation |
EXPLAIN
SELECT *
FROM RestaurantComplexRecord AS R
WHERE EXISTS (SELECT * FROM R.reviews AS RE WHERE RE.rating >= 9)
|
|
|
|
|
|---|---|---|---|---|
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)
|
|
dot_graph |
gml_graph |
continuation |