Operators
All Nodes Scan
The AllNodesScan operator reads all nodes from the node store. The variable that will contain the nodes is seen in the arguments.
Any query using this operator is likely to encounter performance problems on a non-trivial database.
MATCH (n) RETURN n
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+-----------------+----------------+------+---------+-----------+
| Operator | Estimated Rows | Rows | DB Hits | Variables |
+-----------------+----------------+------+---------+-----------+
| +ProduceResults | 35 | 35 | 0 | n |
| | +----------------+------+---------+-----------+
| +AllNodesScan | 35 | 35 | 36 | n |
+-----------------+----------------+------+---------+-----------+
Total database accesses: 36
Directed Relationship By Id Seek
The DirectedRelationshipByIdSeek operator reads one or more relationships by id from the relationship store, and produces both the relationship and the nodes on either side.
MATCH (n1)-[r]->()
WHERE id(r) = 0
RETURN r, n1
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+-------------------------------+----------------+------+---------+-----------------+-----------------------------------------------------------------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Variables | Other |
+-------------------------------+----------------+------+---------+-----------------+-----------------------------------------------------------------------------------+
| +ProduceResults | 1 | 1 | 0 | anon[17], n1, r | |
| | +----------------+------+---------+-----------------+-----------------------------------------------------------------------------------+
| +DirectedRelationshipByIdSeek | 1 | 1 | 1 | anon[17], n1, r | EntityByIdRhs(ManySeekableArgs(ListLiteral(List(Parameter( AUTOINT0,Integer))))) |
+-------------------------------+----------------+------+---------+-----------------+-----------------------------------------------------------------------------------+
Total database accesses: 1
Node By Id Seek
The NodeByIdSeek operator reads one or more nodes by id from the node store.
MATCH (n) WHERE id(n) = 0 RETURN n
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+-----------------+----------------+------+---------+-----------+
| Operator | Estimated Rows | Rows | DB Hits | Variables |
+-----------------+----------------+------+---------+-----------+
| +ProduceResults | 1 | 1 | 0 | n |
| | +----------------+------+---------+-----------+
| +NodeByIdSeek | 1 | 1 | 1 | n |
+-----------------+----------------+------+---------+-----------+
Total database accesses: 1
Node By Label Scan
The NodeByLabelScan operator fetches all nodes with a specific label from the node label index.
MATCH (person:Person) RETURN person
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+------------------+----------------+------+---------+-----------+---------+
| Operator | Estimated Rows | Rows | DB Hits | Variables | Other |
+------------------+----------------+------+---------+-----------+---------+
| +ProduceResults | 14 | 14 | 0 | person | |
| | +----------------+------+---------+-----------+---------+
| +NodeByLabelScan | 14 | 14 | 15 | person | :Person |
+------------------+----------------+------+---------+-----------+---------+
Total database accesses: 15
Node Index Seek
The NodeIndexSeek operator finds nodes using an index seek.
The node variable and the index used is shown in the arguments of the operator.
If the index is a unique index, the operator is instead called NodeUniqueIndexSeek.
MATCH (location:Location {name: 'Malmo'}) RETURN location
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+-----------------+----------------+------+---------+-------------------+-----------+-----------------+
| Operator | Estimated Rows | Rows | DB Hits | Order | Variables | Other |
+-----------------+----------------+------+---------+-------------------+-----------+-----------------+
| +ProduceResults | 1 | 1 | 0 | location.name ASC | location | |
| | +----------------+------+---------+-------------------+-----------+-----------------+
| +NodeIndexSeek | 1 | 1 | 2 | location.name ASC | location | :Location(name) |
+-----------------+----------------+------+---------+-------------------+-----------+-----------------+
Total database accesses: 2
Node Unique Index Seek
The NodeUniqueIndexSeek operator finds nodes using an index seek within a unique index. The node variable and the index used is shown in the arguments of the operator.
If the index is not unique, the operator is instead called NodeIndexSeek.
If the index seek is used to solve a MERGE clause, it will also be marked with (Locking).
This makes it clear that any nodes returned from the index will be locked in order to prevent concurrent conflicting updates.
MATCH (t:Team {name: 'Malmo'}) RETURN t
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+----------------------+----------------+------+---------+------------+-----------+-------------+
| Operator | Estimated Rows | Rows | DB Hits | Order | Variables | Other |
+----------------------+----------------+------+---------+------------+-----------+-------------+
| +ProduceResults | 1 | 0 | 0 | t.name ASC | t | |
| | +----------------+------+---------+------------+-----------+-------------+
| +NodeUniqueIndexSeek | 1 | 0 | 1 | t.name ASC | t | :Team(name) |
+----------------------+----------------+------+---------+------------+-----------+-------------+
Total database accesses: 1
Node Index Seek By Range
The NodeIndexSeekByRange operator finds nodes using an index seek where the value of the property matches a given prefix string.
NodeIndexSeekByRange can be used for STARTS WITH and comparison operators such as <, >, <= and >=.
If the index is a unique index, the operator is instead called NodeUniqueIndexSeekByRange.
MATCH (l:Location) WHERE l.name STARTS WITH 'Lon' RETURN l
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+-----------------------+----------------+------+---------+-----------+------------+-----------+----------------------------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Time (ms) | Order | Variables | Other |
+-----------------------+----------------+------+---------+-----------+------------+-----------+----------------------------------------------+
| +ProduceResults | 2 | 1 | 0 | 0.217 | l.name ASC | l | |
| | +----------------+------+---------+-----------+------------+-----------+----------------------------------------------+
| +NodeIndexSeekByRange | 2 | 1 | 2 | 0.271 | l.name ASC | l | :Location(name STARTS WITH $` AUTOSTRING0`) |
+-----------------------+----------------+------+---------+-----------+------------+-----------+----------------------------------------------+
Total database accesses: 2
Node Unique Index Seek By Range
The NodeUniqueIndexSeekByRange operator finds nodes using an index seek within a unique index, where the value of the property matches a given prefix string.
NodeUniqueIndexSeekByRange is used by STARTS WITH and comparison operators such as <, >, <= and >=.
If the index is not unique, the operator is instead called NodeIndexSeekByRange.
MATCH (t:Team) WHERE t.name STARTS WITH 'Ma' RETURN t
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+-----------------------------+----------------+------+---------+-----------+------------+-----------+------------------------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Time (ms) | Order | Variables | Other |
+-----------------------------+----------------+------+---------+-----------+------------+-----------+------------------------------------------+
| +ProduceResults | 2 | 0 | 0 | 0.027 | t.name ASC | t | |
| | +----------------+------+---------+-----------+------------+-----------+------------------------------------------+
| +NodeUniqueIndexSeekByRange | 2 | 0 | 1 | 0.262 | t.name ASC | t | :Team(name STARTS WITH $` AUTOSTRING0`) |
+-----------------------------+----------------+------+---------+-----------+------------+-----------+------------------------------------------+
Total database accesses: 1
Node Index Contains Scan
The NodeIndexContainsScan operator examines all values stored in an index, searching for entries
containing a specific string; for example, in queries including CONTAINS.
Although this is slower than an index seek (since all entries need to be
examined), it is still faster than the indirection resulting from a label scan using NodeByLabelScan, and a property store
filter.
MATCH (l:Location) WHERE l.name CONTAINS 'al' RETURN l
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+------------------------+----------------+------+---------+------------+-----------+-----------------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Order | Variables | Other |
+------------------------+----------------+------+---------+------------+-----------+-----------------------------------+
| +ProduceResults | 0 | 2 | 0 | l.name ASC | l | |
| | +----------------+------+---------+------------+-----------+-----------------------------------+
| +NodeIndexContainsScan | 0 | 2 | 3 | l.name ASC | l | :Location(name); $` AUTOSTRING0` |
+------------------------+----------------+------+---------+------------+-----------+-----------------------------------+
Total database accesses: 3
Node Index Ends With Scan
The NodeIndexEndsWithScan operator examines all values stored in an index, searching for entries
ending in a specific string; for example, in queries containing ENDS WITH.
Although this is slower than an index seek (since all entries need to be
examined), it is still faster than the indirection resulting from a label scan using NodeByLabelScan, and a property store
filter.
MATCH (l:Location) WHERE l.name ENDS WITH 'al' RETURN l
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+------------------------+----------------+------+---------+------------+-----------+-----------------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Order | Variables | Other |
+------------------------+----------------+------+---------+------------+-----------+-----------------------------------+
| +ProduceResults | 0 | 0 | 0 | l.name ASC | l | |
| | +----------------+------+---------+------------+-----------+-----------------------------------+
| +NodeIndexEndsWithScan | 0 | 0 | 1 | l.name ASC | l | :Location(name); $` AUTOSTRING0` |
+------------------------+----------------+------+---------+------------+-----------+-----------------------------------+
Total database accesses: 1
Node Index Scan
The NodeIndexScan operator examines all values stored in an index, returning all nodes with a particular label having a specified property.
MATCH (l:Location) WHERE exists(l.name) RETURN l
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+-----------------+----------------+------+---------+-----------+-----------------+
| Operator | Estimated Rows | Rows | DB Hits | Variables | Other |
+-----------------+----------------+------+---------+-----------+-----------------+
| +ProduceResults | 10 | 10 | 0 | l | |
| | +----------------+------+---------+-----------+-----------------+
| +NodeIndexScan | 10 | 10 | 11 | l | :Location(name) |
+-----------------+----------------+------+---------+-----------+-----------------+
Total database accesses: 11
Undirected Relationship By Id Seek
The UndirectedRelationshipByIdSeek operator reads one or more relationships by id from the relationship store.
As the direction is unspecified, two rows are produced for each relationship as a result of alternating the combination of the start and end node.
MATCH (n1)-[r]-()
WHERE id(r) = 1
RETURN r, n1
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+---------------------------------+----------------+------+---------+-----------------+
| Operator | Estimated Rows | Rows | DB Hits | Variables |
+---------------------------------+----------------+------+---------+-----------------+
| +ProduceResults | 1 | 2 | 0 | anon[16], n1, r |
| | +----------------+------+---------+-----------------+
| +UndirectedRelationshipByIdSeek | 1 | 2 | 1 | anon[16], n1, r |
+---------------------------------+----------------+------+---------+-----------------+
Total database accesses: 1
Apply
All the different Apply operators (listed below) share the same basic functionality: they perform a nested loop by taking a single row from the left-hand side, and using the Argument operator on the right-hand side, execute the operator tree on the right-hand side.
The versions of the Apply operators differ in how the results are managed.
The Apply operator (i.e. the standard version) takes the row produced by the right-hand side — which at this point contains data from both the left-hand and right-hand sides — and yields it..
MATCH (p:Person {name:'me'})
MATCH (q:Person {name: p.secondName})
RETURN p, q
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+------------------+----------------+------+---------+-----------+------------+-----------+---------------+
| Operator | Estimated Rows | Rows | DB Hits | Time (ms) | Order | Variables | Other |
+------------------+----------------+------+---------+-----------+------------+-----------+---------------+
| +ProduceResults | 1 | 0 | 0 | | p.name ASC | p, q | |
| | +----------------+------+---------+-----------+------------+-----------+---------------+
| +Apply | 1 | 0 | 0 | | p.name ASC | p, q | |
| |\ +----------------+------+---------+-----------+------------+-----------+---------------+
| | +NodeIndexSeek | 1 | 0 | 0 | | | q -- p | :Person(name) |
| | +----------------+------+---------+-----------+------------+-----------+---------------+
| +NodeIndexSeek | 1 | 1 | 2 | 0.182 | p.name ASC | p | :Person(name) |
+------------------+----------------+------+---------+-----------+------------+-----------+---------------+
Total database accesses: 2
Semi Apply
The SemiApply operator tests for the presence of a pattern predicate, and is a variation of the Apply operator.
If the right-hand side operator yields at least one row, the row from the left-hand side operator is yielded by the SemiApply operator.
This makes SemiApply a filtering operator, used mostly for pattern predicates in queries.
MATCH (p:Person)
WHERE (p)-[:FRIENDS_WITH]->(:Person)
RETURN p.name
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+--------------------+----------------+------+---------+-----------------+-------------------+----------------------+------------------------+----------------------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables | Other |
+--------------------+----------------+------+---------+-----------------+-------------------+----------------------+------------------------+----------------------------------------+
| +ProduceResults | 11 | 2 | 0 | 0 | 0 | 0.0000 | p, p.name | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------------------+----------------------------------------+
| +Projection | 11 | 2 | 2 | 1 | 0 | 1.0000 | p.name -- p | {p.name : cache[p.name]} |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------------------+----------------------------------------+
| +SemiApply | 11 | 2 | 0 | 0 | 0 | 0.0000 | p | |
| |\ +----------------+------+---------+-----------------+-------------------+----------------------+------------------------+----------------------------------------+
| | +CacheProperties | 2 | 0 | 0 | 0 | 0 | 0.0000 | NODE45, REL27, p | cache[p.name] |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+------------------------+----------------------------------------+
| | +Filter | 2 | 0 | 2 | 1 | 0 | 1.0000 | NODE45, REL27, p | ` NODE45`:Person |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+------------------------+----------------------------------------+
| | +Expand(All) | 2 | 2 | 16 | 15 | 0 | 1.0000 | NODE45, REL27 -- p | (p)-[ REL27:FRIENDS_WITH]->( NODE45) |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+------------------------+----------------------------------------+
| | +Argument | 14 | 14 | 0 | 0 | 0 | 0.0000 | p | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------------------+----------------------------------------+
| +NodeByLabelScan | 14 | 14 | 15 | 2 | 0 | 1.0000 | p | :Person |
+--------------------+----------------+------+---------+-----------------+-------------------+----------------------+------------------------+----------------------------------------+
Total database accesses: 35
Anti Semi Apply
The AntiSemiApply operator tests for the absence of a pattern, and is a variation of the Apply operator.
If the right-hand side operator yields no rows, the row from the left-hand side operator is yielded by the AntiSemiApply operator.
This makes AntiSemiApply a filtering operator, used for pattern predicates in queries.
MATCH (me:Person {name: "me"}), (other:Person)
WHERE NOT (me)-[:FRIENDS_WITH]->(other)
RETURN other.name
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+--------------------+----------------+------+---------+-----------------+-------------------+----------------------+-------------+-------------------------+--------------------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Order | Variables | Other |
+--------------------+----------------+------+---------+-----------------+-------------------+----------------------+-------------+-------------------------+--------------------------------------+
| +ProduceResults | 4 | 13 | 0 | 0 | 0 | 0.0000 | me.name ASC | me, other, other.name | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-------------+-------------------------+--------------------------------------+
| +Projection | 4 | 13 | 13 | 1 | 0 | 1.0000 | me.name ASC | other.name -- me, other | {other.name : cache[other.name]} |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-------------+-------------------------+--------------------------------------+
| +AntiSemiApply | 4 | 13 | 0 | 0 | 0 | 0.0000 | me.name ASC | me, other | |
| |\ +----------------+------+---------+-----------------+-------------------+----------------------+-------------+-------------------------+--------------------------------------+
| | +CacheProperties | 0 | 0 | 0 | 0 | 0 | 0.0000 | | REL62, me, other | cache[other.name] |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+-------------+-------------------------+--------------------------------------+
| | +Expand(Into) | 0 | 0 | 50 | 16 | 0 | 1.0000 | | REL62 -- me, other | (me)-[ REL62:FRIENDS_WITH]->(other) |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+-------------+-------------------------+--------------------------------------+
| | +Argument | 14 | 14 | 0 | 0 | 0 | 0.0000 | | me, other | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-------------+-------------------------+--------------------------------------+
| +CartesianProduct | 14 | 14 | 0 | 0 | 0 | 0.0000 | me.name ASC | me -- other | |
| |\ +----------------+------+---------+-----------------+-------------------+----------------------+-------------+-------------------------+--------------------------------------+
| | +NodeByLabelScan | 14 | 14 | 15 | 2 | 0 | 1.0000 | | other | :Person |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-------------+-------------------------+--------------------------------------+
| +NodeIndexSeek | 1 | 1 | 2 | 0 | 1 | 0.0000 | me.name ASC | me | :Person(name) |
+--------------------+----------------+------+---------+-----------------+-------------------+----------------------+-------------+-------------------------+--------------------------------------+
Total database accesses: 80
Let Semi Apply
The LetSemiApply operator tests for the presence of a pattern predicate, and is a variation of the Apply operator.
When a query contains multiple pattern predicates separated with OR, LetSemiApply will be used to evaluate the first of these.
It will record the result of evaluating the predicate but will leave any filtering to another operator.
In the example, LetSemiApply will be used to check for the presence of the FRIENDS_WITH
relationship from each person.
MATCH (other:Person)
WHERE (other)-[:FRIENDS_WITH]->(:Person) OR (other)-[:WORKS_IN]->(:Location)
RETURN other.name
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+--------------------+----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables | Other |
+--------------------+----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| +ProduceResults | 13 | 14 | 0 | 0 | 0 | 0.0000 | anon[27], other, other.name | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| +Projection | 13 | 14 | 14 | 1 | 0 | 1.0000 | other.name -- anon[27], other | {other.name : cache[other.name]} |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| +SelectOrSemiApply | 14 | 14 | 0 | 0 | 0 | 0.0000 | anon[27] -- other | `anon[27]` |
| |\ +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| | +Filter | 15 | 0 | 12 | 0 | 0 | 0.0000 | NODE87, REL73, other | ` NODE87`:Location |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| | +Expand(All) | 15 | 12 | 24 | 12 | 0 | 1.0000 | NODE87, REL73 -- other | (other)-[ REL73:WORKS_IN]->( NODE87) |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| | +Argument | 14 | 12 | 0 | 0 | 0 | 0.0000 | other | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| +LetSemiApply | 14 | 14 | 0 | 0 | 0 | 0.0000 | anon[27] -- other | |
| |\ +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| | +CacheProperties | 2 | 0 | 0 | 0 | 0 | 0.0000 | NODE53, REL35, other | cache[other.name] |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| | +Filter | 2 | 0 | 2 | 1 | 0 | 1.0000 | NODE53, REL35, other | ` NODE53`:Person |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| | +Expand(All) | 2 | 2 | 16 | 15 | 0 | 1.0000 | NODE53, REL35 -- other | (other)-[ REL35:FRIENDS_WITH]->( NODE53) |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| | +Argument | 14 | 14 | 0 | 0 | 0 | 0.0000 | other | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| +NodeByLabelScan | 14 | 14 | 15 | 2 | 0 | 1.0000 | other | :Person |
+--------------------+----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
Total database accesses: 83
Let Anti Semi Apply
The LetAntiSemiApply operator tests for the absence of a pattern, and is a variation of the Apply operator.
When a query contains multiple negated pattern predicates — i.e. predicates separated with OR, where at
least one predicate contains NOT — LetAntiSemiApply will be used to evaluate the first of these.
It will record the result of evaluating the predicate but will leave any filtering to another operator.
In the example, LetAntiSemiApply will be used to check for the absence of
the FRIENDS_WITH relationship from each person.
MATCH (other:Person)
WHERE NOT ((other)-[:FRIENDS_WITH]->(:Person)) OR (other)-[:WORKS_IN]->(:Location)
RETURN other.name
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+--------------------+----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables | Other |
+--------------------+----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| +ProduceResults | 11 | 14 | 0 | 0 | 0 | 0.0000 | anon[32], other, other.name | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| +Projection | 11 | 14 | 14 | 1 | 0 | 1.0000 | other.name -- anon[32], other | {other.name : cache[other.name]} |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| +SelectOrSemiApply | 14 | 14 | 0 | 0 | 0 | 0.0000 | anon[32] -- other | `anon[32]` |
| |\ +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| | +Filter | 15 | 0 | 2 | 0 | 0 | 0.0000 | NODE93, REL79, other | ` NODE93`:Location |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| | +Expand(All) | 15 | 2 | 4 | 2 | 0 | 1.0000 | NODE93, REL79 -- other | (other)-[ REL79:WORKS_IN]->( NODE93) |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| | +Argument | 14 | 2 | 0 | 0 | 0 | 0.0000 | other | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| +LetAntiSemiApply | 14 | 14 | 0 | 0 | 0 | 0.0000 | anon[32] -- other | |
| |\ +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| | +CacheProperties | 2 | 0 | 0 | 0 | 0 | 0.0000 | NODE58, REL40, other | cache[other.name] |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| | +Filter | 2 | 0 | 2 | 1 | 0 | 1.0000 | NODE58, REL40, other | ` NODE58`:Person |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| | +Expand(All) | 2 | 2 | 16 | 15 | 0 | 1.0000 | NODE58, REL40 -- other | (other)-[ REL40:FRIENDS_WITH]->( NODE58) |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| | +Argument | 14 | 14 | 0 | 0 | 0 | 0.0000 | other | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| +NodeByLabelScan | 14 | 14 | 15 | 2 | 0 | 1.0000 | other | :Person |
+--------------------+----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
Total database accesses: 53
Select Or Semi Apply
The SelectOrSemiApply operator tests for the presence of a pattern predicate and evaluates a predicate,
and is a variation of the Apply operator.
This operator allows for the mixing of normal predicates and pattern predicates
that check for the presence of a pattern.
First, the normal expression predicate is evaluated, and, only if it returns false, is the costly pattern predicate evaluated.
MATCH (other:Person)
WHERE other.age > 25 OR (other)-[:FRIENDS_WITH]->(:Person)
RETURN other.name
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+--------------------+----------------+------+---------+-----------------+-------------------+----------------------+----------------------------+--------------------------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables | Other |
+--------------------+----------------+------+---------+-----------------+-------------------+----------------------+----------------------------+--------------------------------------------+
| +ProduceResults | 11 | 2 | 0 | 0 | 0 | 0.0000 | other, other.name | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+----------------------------+--------------------------------------------+
| +Projection | 11 | 2 | 2 | 1 | 0 | 1.0000 | other.name -- other | {other.name : cache[other.name]} |
| | +----------------+------+---------+-----------------+-------------------+----------------------+----------------------------+--------------------------------------------+
| +SelectOrSemiApply | 14 | 2 | 14 | 0 | 0 | 0.0000 | other | other.age > $` AUTOINT0` |
| |\ +----------------+------+---------+-----------------+-------------------+----------------------+----------------------------+--------------------------------------------+
| | +CacheProperties | 2 | 0 | 0 | 0 | 0 | 0.0000 | NODE71, REL53, other | cache[other.name] |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+----------------------------+--------------------------------------------+
| | +Filter | 2 | 0 | 2 | 1 | 0 | 1.0000 | NODE71, REL53, other | ` NODE71`:Person |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+----------------------------+--------------------------------------------+
| | +Expand(All) | 2 | 2 | 16 | 15 | 0 | 1.0000 | NODE71, REL53 -- other | (other)-[ REL53:FRIENDS_WITH]->( NODE71) |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+----------------------------+--------------------------------------------+
| | +Argument | 14 | 14 | 0 | 0 | 0 | 0.0000 | other | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+----------------------------+--------------------------------------------+
| +NodeByLabelScan | 14 | 14 | 15 | 2 | 0 | 1.0000 | other | :Person |
+--------------------+----------------+------+---------+-----------------+-------------------+----------------------+----------------------------+--------------------------------------------+
Total database accesses: 49
Select Or Anti Semi Apply
The SelectOrAntiSemiApply operator is used to evaluate OR between a predicate and a negative pattern predicate
(i.e. a pattern predicate preceded with NOT), and is a variation of the Apply operator.
If the predicate returns true, the pattern predicate is not tested.
If the predicate returns false or null, SelectOrAntiSemiApply will instead test the pattern predicate.
MATCH (other:Person)
WHERE other.age > 25 OR NOT (other)-[:FRIENDS_WITH]->(:Person)
RETURN other.name
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+------------------------+----------------+------+---------+-----------------+-------------------+----------------------+----------------------------+--------------------------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables | Other |
+------------------------+----------------+------+---------+-----------------+-------------------+----------------------+----------------------------+--------------------------------------------+
| +ProduceResults | 4 | 12 | 0 | 0 | 0 | 0.0000 | other, other.name | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+----------------------------+--------------------------------------------+
| +Projection | 4 | 12 | 12 | 1 | 0 | 1.0000 | other.name -- other | {other.name : cache[other.name]} |
| | +----------------+------+---------+-----------------+-------------------+----------------------+----------------------------+--------------------------------------------+
| +SelectOrAntiSemiApply | 14 | 12 | 14 | 0 | 0 | 0.0000 | other | other.age > $` AUTOINT0` |
| |\ +----------------+------+---------+-----------------+-------------------+----------------------+----------------------------+--------------------------------------------+
| | +CacheProperties | 2 | 0 | 0 | 0 | 0 | 0.0000 | NODE75, REL57, other | cache[other.name] |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+----------------------------+--------------------------------------------+
| | +Filter | 2 | 0 | 2 | 1 | 0 | 1.0000 | NODE75, REL57, other | ` NODE75`:Person |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+----------------------------+--------------------------------------------+
| | +Expand(All) | 2 | 2 | 16 | 15 | 0 | 1.0000 | NODE75, REL57 -- other | (other)-[ REL57:FRIENDS_WITH]->( NODE75) |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+----------------------------+--------------------------------------------+
| | +Argument | 14 | 14 | 0 | 0 | 0 | 0.0000 | other | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+----------------------------+--------------------------------------------+
| +NodeByLabelScan | 14 | 14 | 15 | 2 | 0 | 1.0000 | other | :Person |
+------------------------+----------------+------+---------+-----------------+-------------------+----------------------+----------------------------+--------------------------------------------+
Total database accesses: 59
Let Select Or Semi Apply
The LetSelectOrSemiApply operator is planned for pattern predicates that are combined with other predicates using OR.
This is a variation of the Apply operator.
MATCH (other:Person)
WHERE (other)-[:FRIENDS_WITH]->(:Person) OR (other)-[:WORKS_IN]->(:Location) OR other.age = 5
RETURN other.name
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables | Other |
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| +ProduceResults | 13 | 14 | 0 | 0 | 0 | 0.0000 | anon[27], other, other.name | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| +Projection | 13 | 14 | 14 | 1 | 0 | 1.0000 | other.name -- anon[27], other | {other.name : cache[other.name]} |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| +SelectOrSemiApply | 14 | 14 | 0 | 0 | 0 | 0.0000 | anon[27] -- other | `anon[27]` |
| |\ +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| | +Filter | 15 | 0 | 12 | 0 | 0 | 0.0000 | NODE87, REL73, other | ` NODE87`:Location |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| | +Expand(All) | 15 | 12 | 24 | 12 | 0 | 1.0000 | NODE87, REL73 -- other | (other)-[ REL73:WORKS_IN]->( NODE87) |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| | +Argument | 14 | 12 | 0 | 0 | 0 | 0.0000 | other | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| +LetSelectOrSemiApply | 14 | 14 | 14 | 0 | 0 | 0.0000 | anon[27] -- other | other.age = $` AUTOINT0` |
| |\ +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| | +CacheProperties | 2 | 0 | 0 | 0 | 0 | 0.0000 | NODE53, REL35, other | cache[other.name] |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| | +Filter | 2 | 0 | 2 | 1 | 0 | 1.0000 | NODE53, REL35, other | ` NODE53`:Person |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| | +Expand(All) | 2 | 2 | 16 | 15 | 0 | 1.0000 | NODE53, REL35 -- other | (other)-[ REL35:FRIENDS_WITH]->( NODE53) |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| | +Argument | 14 | 14 | 0 | 0 | 0 | 0.0000 | other | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| +NodeByLabelScan | 14 | 14 | 15 | 2 | 0 | 1.0000 | other | :Person |
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
Total database accesses: 97
Let Select Or Anti Semi Apply
The LetSelectOrAntiSemiApply operator is planned for negated pattern predicates — i.e. pattern predicates
preceded with NOT — that are combined with other predicates using OR.
This operator is a variation of the Apply operator.
MATCH (other:Person)
WHERE NOT (other)-[:FRIENDS_WITH]->(:Person) OR (other)-[:WORKS_IN]->(:Location) OR other.age = 5
RETURN other.name
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+---------------------------+----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables | Other |
+---------------------------+----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| +ProduceResults | 11 | 14 | 0 | 0 | 0 | 0.0000 | anon[31], other, other.name | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| +Projection | 11 | 14 | 14 | 1 | 0 | 1.0000 | other.name -- anon[31], other | {other.name : cache[other.name]} |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| +SelectOrSemiApply | 14 | 14 | 0 | 0 | 0 | 0.0000 | anon[31] -- other | `anon[31]` |
| |\ +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| | +Filter | 15 | 0 | 2 | 0 | 0 | 0.0000 | NODE91, REL77, other | ` NODE91`:Location |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| | +Expand(All) | 15 | 2 | 4 | 2 | 0 | 1.0000 | NODE91, REL77 -- other | (other)-[ REL77:WORKS_IN]->( NODE91) |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| | +Argument | 14 | 2 | 0 | 0 | 0 | 0.0000 | other | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| +LetSelectOrAntiSemiApply | 14 | 14 | 14 | 0 | 0 | 0.0000 | anon[31] -- other | other.age = $` AUTOINT0` |
| |\ +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| | +CacheProperties | 2 | 0 | 0 | 0 | 0 | 0.0000 | NODE57, REL39, other | cache[other.name] |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| | +Filter | 2 | 0 | 2 | 1 | 0 | 1.0000 | NODE57, REL39, other | ` NODE57`:Person |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| | +Expand(All) | 2 | 2 | 16 | 15 | 0 | 1.0000 | NODE57, REL39 -- other | (other)-[ REL39:FRIENDS_WITH]->( NODE57) |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| | +Argument | 14 | 14 | 0 | 0 | 0 | 0.0000 | other | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
| +NodeByLabelScan | 14 | 14 | 15 | 2 | 0 | 1.0000 | other | :Person |
+---------------------------+----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------+--------------------------------------------+
Total database accesses: 67
Conditional Apply
The ConditionalApply operator checks whether a variable is not null, and if so, the right child operator will be executed.
This operator is a variation of the Apply operator.
MERGE (p:Person {name: 'Andy'})
ON MATCH SET p.exists = true
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+---------------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Order | Variables | Other |
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+---------------+
| +ProduceResults | 1 | 0 | 0 | 0 | 0 | 0.0000 | | p | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+---------------+
| +EmptyResult | 1 | 0 | 0 | 0 | 0 | 0.0000 | | p | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+---------------+
| +AntiConditionalApply | 1 | 1 | 0 | 0 | 0 | 0.0000 | | p | |
| |\ +----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+---------------+
| | +MergeCreateNode | 1 | 0 | 0 | 0 | 0 | 0.0000 | | p | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+---------------+
| +ConditionalApply | 1 | 1 | 0 | 0 | 0 | 0.0000 | | p | |
| |\ +----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+---------------+
| | +SetProperty | 1 | 1 | 3 | 2 | | | | p | |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+---------------+
| | +Argument | 1 | 1 | 0 | 0 | 0 | 0.0000 | | p | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+---------------+
| +Optional | 1 | 1 | 0 | 0 | 0 | 0.0000 | p.name ASC | p | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+---------------+
| +NodeIndexSeek | 1 | 1 | 2 | 0 | 1 | 0.0000 | p.name ASC | p | :Person(name) |
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+---------------+
Total database accesses: 5
Anti Conditional Apply
The AntiConditionalApply operator checks whether a variable is null, and if so, the right child operator will be executed.
This operator is a variation of the Apply operator.
MERGE (p:Person {name: 'Andy'})
ON CREATE SET p.exists = true
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+---------------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Order | Variables | Other |
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+---------------+
| +ProduceResults | 1 | 0 | 0 | 0 | 0 | 0.0000 | | p | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+---------------+
| +EmptyResult | 1 | 0 | 0 | 0 | 0 | 0.0000 | | p | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+---------------+
| +AntiConditionalApply | 1 | 1 | 0 | 0 | 0 | 0.0000 | | p | |
| |\ +----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+---------------+
| | +SetProperty | 1 | 0 | 0 | 0 | 0 | 0.0000 | | p | |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+---------------+
| | +MergeCreateNode | 1 | 0 | 0 | 0 | 0 | 0.0000 | | p | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+---------------+
| +Optional | 1 | 1 | 0 | 0 | 0 | 0.0000 | p.name ASC | p | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+---------------+
| +NodeIndexSeek | 1 | 1 | 2 | 0 | 1 | 0.0000 | p.name ASC | p | :Person(name) |
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+---------------+
Total database accesses: 2
Roll Up Apply
The RollUpApply operator is used to execute an expression which takes as input a pattern, and returns a list with content from the matched pattern;
for example, when using a pattern expression or pattern comprehension in a query.
This operator is a variation of the Apply operator.
MATCH (p:Person)
RETURN p.name, [ (p)-[:WORKS_IN]->(location) | location.name ] AS cities
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+--------------------+----------------+------+---------+-----------------+-------------------+----------------------+----------------------------------+------------------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables | Other |
+--------------------+----------------+------+---------+-----------------+-------------------+----------------------+----------------------------------+------------------------------------+
| +ProduceResults | 14 | 14 | 0 | 0 | 0 | 0.0000 | cities, p, p.name | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+----------------------------------+------------------------------------+
| +Projection | 14 | 14 | 14 | 0 | 0 | 0.0000 | p.name -- cities, p | {p.name : cache[p.name]} |
| | +----------------+------+---------+-----------------+-------------------+----------------------+----------------------------------+------------------------------------+
| +RollUpApply | 14 | 14 | 0 | 0 | 0 | 0.0000 | cities -- p | cities |
| |\ +----------------+------+---------+-----------------+-------------------+----------------------+----------------------------------+------------------------------------+
| | +Projection | 0 | 15 | 15 | 0 | 0 | 0.0000 | anon[32] -- REL38, location, p | { : location.name} |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+----------------------------------+------------------------------------+
| | +CacheProperties | 0 | 15 | 15 | 2 | 0 | 1.0000 | REL38, location, p | cache[p.name] |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+----------------------------------+------------------------------------+
| | +Expand(All) | 0 | 15 | 29 | 15 | 0 | 1.0000 | REL38, location -- p | (p)-[ REL38:WORKS_IN]->(location) |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+----------------------------------+------------------------------------+
| | +Argument | 1 | 14 | 0 | 0 | 0 | 0.0000 | p | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+----------------------------------+------------------------------------+
| +NodeByLabelScan | 14 | 14 | 15 | 2 | 0 | 1.0000 | p | :Person |
+--------------------+----------------+------+---------+-----------------+-------------------+----------------------+----------------------------------+------------------------------------+
Total database accesses: 88
Argument
The Argument operator indicates the variable to be used as an argument to the right-hand side of an Apply operator.
MATCH (s:Person {name: 'me'}) MERGE (s)-[:FRIENDS_WITH]->(s)
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+------------------------------+----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Order | Variables | Other |
+------------------------------+----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| +ProduceResults | 1 | 0 | 0 | 0 | 0 | 0.0000 | | anon[40], s | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| +EmptyResult | 1 | 0 | 0 | 0 | 0 | 0.0000 | | anon[40], s | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| +Apply | 1 | 1 | 0 | 0 | 0 | 0.0000 | | anon[40], s | |
| |\ +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | +AntiConditionalApply | 1 | 1 | 0 | 0 | 0 | 0.0000 | | anon[40], s | |
| | |\ +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | | +MergeCreateRelationship | 1 | 1 | 2 | 2 | 0 | 1.0000 | | anon[40] -- s | |
| | | | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | | +Argument | 1 | 1 | 0 | 0 | 0 | 0.0000 | | s | |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | +AntiConditionalApply | 1 | 1 | 0 | 0 | 0 | 0.0000 | | anon[40], s | |
| | |\ +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | | +Optional | 1 | 1 | 0 | 0 | 0 | 0.0000 | | anon[40], s | |
| | | | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | | +Expand(Into) | 0 | 0 | 4 | 1 | 0 | 1.0000 | | anon[40] -- s | (s)-[:FRIENDS_WITH]->(s) |
| | | | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | | +LockNodes | 1 | 1 | 0 | 0 | 0 | 0.0000 | | s | s |
| | | | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | | +Argument | 1 | 1 | 0 | 0 | 0 | 0.0000 | | s | |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | +Optional | 1 | 1 | 0 | 0 | 0 | 0.0000 | | anon[40], s | |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | +Expand(Into) | 0 | 0 | 4 | 3 | 0 | 1.0000 | | anon[40] -- s | (s)-[:FRIENDS_WITH]->(s) |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | +Argument | 1 | 1 | 0 | 0 | 0 | 0.0000 | | s | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| +NodeIndexSeek | 1 | 1 | 2 | 0 | 1 | 0.0000 | s.name ASC | s | :Person(name) |
+------------------------------+----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
Total database accesses: 12
Expand All
Given a start node, and depending on the pattern relationship, the Expand(All) operator will traverse incoming or outgoing relationships.
MATCH (p:Person {name: 'me'})-[:FRIENDS_WITH]->(fof) RETURN fof
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+-----------------+----------------+------+---------+------------+--------------------+----------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Order | Variables | Other |
+-----------------+----------------+------+---------+------------+--------------------+----------------------------+
| +ProduceResults | 0 | 1 | 0 | p.name ASC | anon[30], fof, p | |
| | +----------------+------+---------+------------+--------------------+----------------------------+
| +Expand(All) | 0 | 1 | 3 | p.name ASC | anon[30], fof -- p | (p)-[:FRIENDS_WITH]->(fof) |
| | +----------------+------+---------+------------+--------------------+----------------------------+
| +NodeIndexSeek | 1 | 1 | 2 | p.name ASC | p | :Person(name) |
+-----------------+----------------+------+---------+------------+--------------------+----------------------------+
Total database accesses: 5
Expand Into
When both the start and end node have already been found, the Expand(Into) operator is used to find all relationships connecting the two nodes.
As both the start and end node of the relationship are already in scope, the node with the smallest degree will be used.
This can make a noticeable difference when dense nodes appear as end points.
MATCH (p:Person {name: 'me'})-[:FRIENDS_WITH]->(fof)-->(p) RETURN fof
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+-----------------+----------------+------+---------+-----------+------------+------------------------------+-----------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Time (ms) | Order | Variables | Other |
+-----------------+----------------+------+---------+-----------+------------+------------------------------+-----------------------------+
| +ProduceResults | 0 | 0 | 0 | 0.000 | p.name ASC | anon[30], anon[53], fof, p | |
| | +----------------+------+---------+-----------+------------+------------------------------+-----------------------------+
| +Filter | 0 | 0 | 0 | 0.000 | p.name ASC | anon[30], anon[53], fof, p | not `anon[30]` = `anon[53]` |
| | +----------------+------+---------+-----------+------------+------------------------------+-----------------------------+
| +Expand(Into) | 0 | 0 | 0 | 0.008 | p.name ASC | anon[30] -- anon[53], fof, p | (p)-[:FRIENDS_WITH]->(fof) |
| | +----------------+------+---------+-----------+------------+------------------------------+-----------------------------+
| +Expand(All) | 0 | 0 | 3 | | p.name ASC | anon[53], fof -- p | (p)<--(fof) |
| | +----------------+------+---------+-----------+------------+------------------------------+-----------------------------+
| +NodeIndexSeek | 1 | 1 | 2 | | p.name ASC | p | :Person(name) |
+-----------------+----------------+------+---------+-----------+------------+------------------------------+-----------------------------+
Total database accesses: 5
Optional Expand All
The OptionalExpand(All) operator is analogous to Expand(All), apart from when no relationships match the direction, type and property predicates.
In this situation, OptionalExpand(all) will return a single row with the relationship and end node set to null.
MATCH (p:Person)
OPTIONAL MATCH (p)-[works_in:WORKS_IN]->(l) WHERE works_in.duration > 180
RETURN p, l
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+----------------------+----------------+------+---------+-----------+------------------+-----------------------------------------------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Time (ms) | Variables | Other |
+----------------------+----------------+------+---------+-----------+------------------+-----------------------------------------------------------------+
| +ProduceResults | 14 | 15 | 0 | 1.414 | l, p, works_in | |
| | +----------------+------+---------+-----------+------------------+-----------------------------------------------------------------+
| +OptionalExpand(All) | 14 | 15 | 44 | 14.365 | l, works_in -- p | works_in.duration > $` AUTOINT0`; (p)-[works_in:WORKS_IN]->(l) |
| | +----------------+------+---------+-----------+------------------+-----------------------------------------------------------------+
| +NodeByLabelScan | 14 | 14 | 15 | 0.554 | p | :Person |
+----------------------+----------------+------+---------+-----------+------------------+-----------------------------------------------------------------+
Total database accesses: 59
Optional Expand Into
The OptionalExpand(Into) operator is analogous to Expand(Into), apart from when no matching relationships are found.
In this situation, OptionalExpand(Into) will return a single row with the relationship and end node set to null.
As both the start and end node of the relationship are already in scope, the node with the smallest degree will be used.
This can make a noticeable difference when dense nodes appear as end points.
MATCH (p:Person)-[works_in:WORKS_IN]->(l) OPTIONAL MATCH (l)-->(p) RETURN p
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+-----------------------+----------------+------+---------+-----------+----------------------------+------------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Time (ms) | Variables | Other |
+-----------------------+----------------+------+---------+-----------+----------------------------+------------------------------+
| +ProduceResults | 15 | 15 | 0 | 0.586 | anon[61], l, p, works_in | |
| | +----------------+------+---------+-----------+----------------------------+------------------------------+
| +OptionalExpand(Into) | 15 | 15 | 48 | 3.261 | anon[61] -- l, p, works_in | (l)-->(p) |
| | +----------------+------+---------+-----------+----------------------------+------------------------------+
| +Expand(All) | 15 | 15 | 33 | | l, works_in -- p | (p)-[works_in:WORKS_IN]->(l) |
| | +----------------+------+---------+-----------+----------------------------+------------------------------+
| +NodeByLabelScan | 14 | 14 | 15 | | p | :Person |
+-----------------------+----------------+------+---------+-----------+----------------------------+------------------------------+
Total database accesses: 96
VarLength Expand All
Given a start node, the VarLengthExpand(All) operator will traverse variable-length relationships.
MATCH (p:Person)-[:FRIENDS_WITH *1..2]-(q:Person) RETURN p, q
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+-----------------------+----------------+------+---------+------------------+-----------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Variables | Other |
+-----------------------+----------------+------+---------+------------------+-----------------------------+
| +ProduceResults | 4 | 6 | 0 | anon[17], p, q | |
| | +----------------+------+---------+------------------+-----------------------------+
| +Filter | 4 | 6 | 6 | anon[17], p, q | q:Person |
| | +----------------+------+---------+------------------+-----------------------------+
| +VarLengthExpand(All) | 4 | 6 | 47 | anon[17], q -- p | (p)-[:FRIENDS_WITH*..2]-(q) |
| | +----------------+------+---------+------------------+-----------------------------+
| +NodeByLabelScan | 14 | 14 | 15 | p | :Person |
+-----------------------+----------------+------+---------+------------------+-----------------------------+
Total database accesses: 68
VarLength Expand Into
When both the start and end node have already been found, the VarLengthExpand(Into) operator is used to find all variable-length relationships connecting the two nodes.
MATCH (p:Person)-[:FRIENDS_WITH *1..2]-(p:Person) RETURN p
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+------------------------+----------------+------+---------+---------------+-----------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Variables | Other |
+------------------------+----------------+------+---------+---------------+-----------------------------+
| +ProduceResults | 0 | 0 | 0 | anon[17], p | |
| | +----------------+------+---------+---------------+-----------------------------+
| +VarLengthExpand(Into) | 0 | 0 | 47 | anon[17] -- p | (p)-[:FRIENDS_WITH*..2]-(p) |
| | +----------------+------+---------+---------------+-----------------------------+
| +NodeByLabelScan | 14 | 14 | 15 | p | :Person |
+------------------------+----------------+------+---------+---------------+-----------------------------+
Total database accesses: 62
VarLength Expand Pruning
Given a start node, the VarLengthExpand(Pruning) operator will traverse variable-length relationships much like the VarLengthExpand(All) operator.
However, as an optimization, some paths will not be explored if they are guaranteed to produce an end node that has already been found (by means of a previous path traversal).
This will only be used in cases where the individual paths are not of interest.
This operator guarantees that all the end nodes produced will be unique.
MATCH (p:Person)-[:FRIENDS_WITH *3..4]-(q:Person) RETURN DISTINCT p, q
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+---------------------------+----------------+------+---------+-----------+-----------+------------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Time (ms) | Variables | Other |
+---------------------------+----------------+------+---------+-----------+-----------+------------------------------+
| +ProduceResults | 0 | 0 | 0 | 0.010 | p, q | |
| | +----------------+------+---------+-----------+-----------+------------------------------+
| +Distinct | 0 | 0 | 0 | 0.019 | p, q | p, q |
| | +----------------+------+---------+-----------+-----------+------------------------------+
| +Filter | 0 | 0 | 0 | 0.076 | p, q | q:Person |
| | +----------------+------+---------+-----------+-----------+------------------------------+
| +VarLengthExpand(Pruning) | 0 | 0 | 32 | 10.816 | q -- p | (p)-[:FRIENDS_WITH*3..4]-(q) |
| | +----------------+------+---------+-----------+-----------+------------------------------+
| +NodeByLabelScan | 14 | 14 | 15 | 0.086 | p | :Person |
+---------------------------+----------------+------+---------+-----------+-----------+------------------------------+
Total database accesses: 47
Assert Same Node
The AssertSameNode operator is used to ensure that no unique constraints are violated.
The example looks for the presence of a team with the supplied name and id, and if one does not exist,
it will be created. Owing to the existence of two unique constraints
on :Team(name) and :Team(id), any node that would be found by the UniqueIndexSeek
must be the very same node, or the constraints would be violated.
MERGE (t:Team {name: 'Engineering', id: 42})
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+---------------------------------+----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+-------------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Order | Variables | Other |
+---------------------------------+----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+-------------+
| +ProduceResults | 1 | 0 | 0 | 0 | 0 | 0.0000 | | t | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+-------------+
| +EmptyResult | 1 | 0 | 0 | 0 | 0 | 0.0000 | | t | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+-------------+
| +AntiConditionalApply | 1 | 1 | 0 | 0 | 0 | 0.0000 | | t | |
| |\ +----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+-------------+
| | +MergeCreateNode | 1 | 0 | 0 | 0 | 0 | 0.0000 | | t | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+-------------+
| +Optional | 1 | 1 | 0 | 0 | 0 | 0.0000 | t.name ASC | t | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+-------------+
| +AssertSameNode | 0 | 1 | 0 | 0 | 0 | 0.0000 | t.name ASC | t | |
| |\ +----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+-------------+
| | +NodeUniqueIndexSeek(Locking) | 1 | 1 | 1 | 0 | 1 | 0.0000 | t.id ASC | t | :Team(id) |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+-------------+
| +NodeUniqueIndexSeek(Locking) | 1 | 1 | 1 | 0 | 1 | 0.0000 | t.name ASC | t | :Team(name) |
+---------------------------------+----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+-------------+
Total database accesses: 2
Drop Result
The DropResult operator produces zero rows.
It is applied when it can be deduced through static analysis that the result of an expression will be empty, such as when a predicate guaranteed to return false (e.g. 1 > 5) is used in a query.
MATCH (p) WHERE false RETURN p
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| +ProduceResults | 0 | 0 | 0 | 0 | 0 | 0.0000 | p |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| +DropResult | 0 | 0 | 0 | 0 | 0 | 0.0000 | p |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| +AllNodesScan | 35 | 0 | 0 | 0 | 0 | 0.0000 | p |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+
Total database accesses: 0
Empty Result
The EmptyResult operator eagerly loads all incoming data and discards it.
CREATE (:Person)
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| +ProduceResults | 1 | 0 | 0 | 0 | 0 | 0.0000 | anon[8] |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| +EmptyResult | 1 | 0 | 0 | 0 | 0 | 0.0000 | anon[8] |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| +Create | 1 | 1 | 1 | 0 | 0 | 0.0000 | anon[8] |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+
Total database accesses: 1
Produce Results
The ProduceResults operator prepares the result so that it is consumable by the user, such as transforming internal values to user values.
It is present in every single query that returns data to the user, and has little bearing on performance optimisation.
MATCH (n) RETURN n
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+-----------------+----------------+------+---------+-----------+
| Operator | Estimated Rows | Rows | DB Hits | Variables |
+-----------------+----------------+------+---------+-----------+
| +ProduceResults | 35 | 35 | 0 | n |
| | +----------------+------+---------+-----------+
| +AllNodesScan | 35 | 35 | 36 | n |
+-----------------+----------------+------+---------+-----------+
Total database accesses: 36
Load CSV
The LoadCSV operator loads data from a CSV source into the query.
It is used whenever the LOAD CSV clause is used in a query.
LOAD CSV FROM 'https://neo4j.com/docs/cypher-refcard/3.3/csv/artists.csv' AS line RETURN line
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| +ProduceResults | 1 | 4 | 0 | 0 | 0 | 0.0000 | line |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| +LoadCSV | 1 | 4 | 0 | 0 | 0 | 0.0000 | line |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+
Total database accesses: 0
Hash joins in general
Hash joins have two inputs: the build input and probe input. The query planner assigns these roles so that the smaller of the two inputs is the build input. The build input is pulled in eagerly, and is used to build a probe table. Once this is complete, the probe table is checked for each row coming from the probe input side.
In query plans, the build input is always the left operator, and the probe input the right operator.
There are four hash join operators:
Node Hash Join
The NodeHashJoin operator is a variation of the hash join.
NodeHashJoin executes the hash join on node ids.
As primitive types and arrays can be used, it can be done very efficiently.
MATCH (bob:Person {name:'Bob'})-[:WORKS_IN]->(loc)<-[:WORKS_IN]-(matt:Person {name:'Mattis'})
RETURN loc.name
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+------------------+----------------+------+---------+-----------+---------------+------------------------------------------------+-----------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Time (ms) | Order | Variables | Other |
+------------------+----------------+------+---------+-----------+---------------+------------------------------------------------+-----------------------------+
| +ProduceResults | 10 | 0 | 0 | 0.000 | matt.name ASC | anon[32], anon[51], bob, loc, loc.name, matt | |
| | +----------------+------+---------+-----------+---------------+------------------------------------------------+-----------------------------+
| +Projection | 10 | 0 | 0 | 0.000 | matt.name ASC | loc.name -- anon[32], anon[51], bob, loc, matt | {loc.name : loc.name} |
| | +----------------+------+---------+-----------+---------------+------------------------------------------------+-----------------------------+
| +Filter | 10 | 0 | 0 | 0.000 | matt.name ASC | anon[32], anon[51], bob, loc, matt | not `anon[32]` = `anon[51]` |
| | +----------------+------+---------+-----------+---------------+------------------------------------------------+-----------------------------+
| +NodeHashJoin | 10 | 0 | 0 | 0.080 | matt.name ASC | anon[32], bob -- anon[51], loc, matt | loc |
| |\ +----------------+------+---------+-----------+---------------+------------------------------------------------+-----------------------------+
| | +Expand(All) | 19 | 0 | 0 | | matt.name ASC | anon[51], loc -- matt | (matt)-[:WORKS_IN]->(loc) |
| | | +----------------+------+---------+-----------+---------------+------------------------------------------------+-----------------------------+
| | +NodeIndexSeek | 1 | 0 | 1 | | matt.name ASC | matt | :Person(name) |
| | +----------------+------+---------+-----------+---------------+------------------------------------------------+-----------------------------+
| +Expand(All) | 19 | 1 | 3 | | bob.name ASC | anon[32], loc -- bob | (bob)-[:WORKS_IN]->(loc) |
| | +----------------+------+---------+-----------+---------------+------------------------------------------------+-----------------------------+
| +NodeIndexSeek | 1 | 1 | 2 | | bob.name ASC | bob | :Person(name) |
+------------------+----------------+------+---------+-----------+---------------+------------------------------------------------+-----------------------------+
Total database accesses: 6
Value Hash Join
The ValueHashJoin operator is a variation of the hash join.
This operator allows for arbitrary values to be used as the join key.
It is most frequently used to solve predicates of the form: n.prop1 = m.prop2 (i.e. equality predicates between two property columns).
MATCH (p:Person),(q:Person)
WHERE p.age = q.age
RETURN p,q
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+--------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+---------------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables | Other |
+--------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+---------------+
| +ProduceResults | 0 | 0 | 0 | 0 | 0 | 0.0000 | p, q | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------+---------------+
| +ValueHashJoin | 0 | 0 | 14 | 0 | 0 | 0.0000 | p -- q | p.age = q.age |
| |\ +----------------+------+---------+-----------------+-------------------+----------------------+-----------+---------------+
| | +NodeByLabelScan | 14 | 0 | 1 | 2 | 0 | 1.0000 | q | :Person |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------+---------------+
| +NodeByLabelScan | 14 | 14 | 15 | 2 | 0 | 1.0000 | p | :Person |
+--------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+---------------+
Total database accesses: 30
Node Left/Right Outer Hash Join
The NodeLeftOuterHashJoin and NodeRightOuterHashJoin operators are variations of the hash join.
The query below can be planned with either a left or a right outer join.
The decision depends on the cardinalities of the left-hand and right-hand sides; i.e. how many rows would be returned, respectively, for (a:Person) and (a)-→(b:Person).
If (a:Person) returns fewer results than (a)-→(b:Person), a left outer join — indicated by NodeLeftOuterHashJoin — is planned.
On the other hand, if (a:Person) returns more results than (a)-→(b:Person), a right outer join — indicated by NodeRightOuterHashJoin — is planned instead.
MATCH (a:Person)
OPTIONAL MATCH (a)-->(b:Person)
USING JOIN ON a
RETURN a.name, b.name
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+-------------------------+----------------+------+---------+-----------------+-------------------+----------------------+----------------------------------+--------------------------------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables | Other |
+-------------------------+----------------+------+---------+-----------------+-------------------+----------------------+----------------------------------+--------------------------------------------------+
| +ProduceResults | 14 | 14 | 0 | 0 | 0 | 0.0000 | anon[36], a, a.name, b, b.name | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+----------------------------------+--------------------------------------------------+
| +Projection | 14 | 14 | 12 | 0 | 0 | 0.0000 | a.name, b.name -- anon[36], a, b | {a.name : cache[a.name], b.name : cache[b.name]} |
| | +----------------+------+---------+-----------------+-------------------+----------------------+----------------------------------+--------------------------------------------------+
| +NodeRightOuterHashJoin | 14 | 14 | 0 | 0 | 0 | 0.0000 | anon[36], b -- a | a |
| |\ +----------------+------+---------+-----------------+-------------------+----------------------+----------------------------------+--------------------------------------------------+
| | +NodeByLabelScan | 14 | 14 | 15 | 2 | 0 | 1.0000 | a | :Person |
| | +----------------+------+---------+-----------------+-------------------+----------------------+----------------------------------+--------------------------------------------------+
| +CacheProperties | 2 | 2 | 4 | 2 | 0 | 1.0000 | anon[36], a, b | cache[a.name]; cache[b.name] |
| | +----------------+------+---------+-----------------+-------------------+----------------------+----------------------------------+--------------------------------------------------+
| +Expand(All) | 2 | 2 | 16 | 15 | 0 | 1.0000 | anon[36], a -- b | (b)<--(a) |
| | +----------------+------+---------+-----------------+-------------------+----------------------+----------------------------------+--------------------------------------------------+
| +NodeByLabelScan | 14 | 14 | 15 | 2 | 0 | 1.0000 | b | :Person |
+-------------------------+----------------+------+---------+-----------------+-------------------+----------------------+----------------------------------+--------------------------------------------------+
Total database accesses: 62
Triadic Selection
The TriadicSelection operator is used to solve triangular queries, such as the very
common 'find my friend-of-friends that are not already my friend'.
It does so by putting all the friends into a set, and uses the set to check if the
friend-of-friends are already connected to me.
The example finds the names of all friends of my friends that are not already my friends.
MATCH (me:Person)-[:FRIENDS_WITH]-()-[:FRIENDS_WITH]-(other)
WHERE NOT (me)-[:FRIENDS_WITH]-(other)
RETURN other.name
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+-------------------+----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------------------------------+-----------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables | Other |
+-------------------+----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------------------------------+-----------------------------+
| +ProduceResults | 0 | 2 | 0 | 0 | 0 | 0.0000 | anon[18], anon[35], anon[37], me, other, other.name | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------------------------------+-----------------------------+
| +Projection | 0 | 2 | 2 | 2 | 0 | 1.0000 | other.name -- anon[18], anon[35], anon[37], me, other | {other.name : other.name} |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------------------------------+-----------------------------+
| +TriadicSelection | 0 | 2 | 0 | 0 | 0 | 0.0000 | anon[18], anon[35], anon[37], me, other | me, anon[35], other |
| |\ +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------------------------------+-----------------------------+
| | +Filter | 0 | 2 | 0 | 0 | 0 | 0.0000 | anon[18], anon[35], anon[37], me, other | not `anon[18]` = `anon[37]` |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------------------------------+-----------------------------+
| | +Expand(All) | 0 | 6 | 10 | 4 | 0 | 1.0000 | anon[37], other -- anon[18], anon[35], me | ()-[:FRIENDS_WITH]-(other) |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------------------------------+-----------------------------+
| | +Argument | 4 | 4 | 0 | 0 | 0 | 0.0000 | anon[18], anon[35], me | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------------------------------+-----------------------------+
| +Expand(All) | 4 | 4 | 18 | 15 | 0 | 1.0000 | anon[18], anon[35] -- me | (me)-[:FRIENDS_WITH]-() |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------------------------------+-----------------------------+
| +NodeByLabelScan | 14 | 14 | 15 | 2 | 0 | 1.0000 | me | :Person |
+-------------------+----------------+------+---------+-----------------+-------------------+----------------------+-------------------------------------------------------+-----------------------------+
Total database accesses: 45
Cartesian Product
The CartesianProduct operator produces a cartesian product of the two inputs — each row coming from the left child operator will be combined with all the rows from the right child operator.
CartesianProduct generally exhibits bad performance and ought to be avoided if possible.
MATCH (p:Person), (t:Team) RETURN p, t
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+--------------------+----------------+------+---------+-----------+-----------+---------+
| Operator | Estimated Rows | Rows | DB Hits | Time (ms) | Variables | Other |
+--------------------+----------------+------+---------+-----------+-----------+---------+
| +ProduceResults | 140 | 140 | 0 | 5.204 | p, t | |
| | +----------------+------+---------+-----------+-----------+---------+
| +CartesianProduct | 140 | 140 | 0 | 0.787 | t -- p | |
| |\ +----------------+------+---------+-----------+-----------+---------+
| | +NodeByLabelScan | 14 | 14 | 15 | 0.125 | p | :Person |
| | +----------------+------+---------+-----------+-----------+---------+
| +NodeByLabelScan | 10 | 10 | 11 | 0.118 | t | :Team |
+--------------------+----------------+------+---------+-----------+-----------+---------+
Total database accesses: 26
Foreach
The Foreach operator executes a nested loop between the left child operator and the right child operator.
In an analogous manner to the Apply operator, it takes a row from the left-hand side and, using the Argument operator, provides it to the operator tree on the right-hand side.
Foreach will yield all the rows coming in from the left-hand side; all results from the right-hand side are pulled in and discarded.
FOREACH (value IN [1,2,3] |
CREATE (:Person {age: value})
)
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-------------------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-------------------+
| +ProduceResults | 1 | 0 | 0 | 0 | 0 | 0.0000 | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------+
| +EmptyResult | 1 | 0 | 0 | 0 | 0 | 0.0000 | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------+
| +Foreach | 1 | 1 | 0 | 0 | 0 | 0.0000 | |
| |\ +----------------+------+---------+-----------------+-------------------+----------------------+-------------------+
| | +Create | 1 | 3 | 9 | 0 | 0 | 0.0000 | anon[36] -- value |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------+
| | +Argument | 1 | 3 | 0 | 0 | 0 | 0.0000 | value |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------+
| +EmptyRow | 1 | 1 | 0 | 0 | 0 | 0.0000 | |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-------------------+
Total database accesses: 9
Eager
For isolation purposes, the Eager operator ensures that operations affecting subsequent operations are executed fully for the whole dataset before continuing execution.
Information from the stores is fetched in a lazy manner; i.e. the pattern matching might not be fully exhausted before updates are applied.
To guarantee reasonable semantics, the query planner will insert Eager operators into the query plan to prevent updates from influencing pattern matching;
this scenario is exemplified by the query below, where the DELETE clause influences the MATCH clause.
The Eager operator can cause high memory usage when importing data or migrating graph structures.
In such cases, the operations should be split into simpler steps; e.g. importing nodes and relationships separately.
Alternatively, the records to be updated can be returned, followed by an update statement.
MATCH (a)-[r]-(b) DELETE r,a,b MERGE ()
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+-------------------------+----------------+------+---------+-----------------+-------------------+----------------------+---------------------+--------------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables | Other |
+-------------------------+----------------+------+---------+-----------------+-------------------+----------------------+---------------------+--------------+
| +ProduceResults | 1 | 0 | 0 | 0 | 0 | 0.0000 | anon[38], a, b, r | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+---------------------+--------------+
| +EmptyResult | 1 | 0 | 0 | 0 | 0 | 0.0000 | anon[38], a, b, r | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+---------------------+--------------+
| +Apply | 1 | 504 | 0 | 0 | 0 | 0.0000 | a, b, r -- anon[38] | |
| |\ +----------------+------+---------+-----------------+-------------------+----------------------+---------------------+--------------+
| | +AntiConditionalApply | 1 | 504 | 0 | 0 | 0 | 0.0000 | anon[38] | |
| | |\ +----------------+------+---------+-----------------+-------------------+----------------------+---------------------+--------------+
| | | +MergeCreateNode | 1 | 0 | 0 | 0 | 0 | 0.0000 | anon[38] | |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+---------------------+--------------+
| | +Optional | 35 | 504 | 0 | 0 | 0 | 0.0000 | anon[38] | |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+---------------------+--------------+
| | +AllNodesScan | 35 | 504 | 540 | 0 | 0 | 0.0000 | anon[38] | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+---------------------+--------------+
| +Eager | 36 | 36 | 0 | 0 | 0 | 0.0000 | a, b, r | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+---------------------+--------------+
| +Delete(3) | 36 | 36 | 39 | 20 | 0 | 2.0000 | a, b, r | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+---------------------+--------------+
| +Eager | 36 | 36 | 0 | 0 | 0 | 0.0000 | a, b, r | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+---------------------+--------------+
| +Expand(All) | 36 | 36 | 71 | 22 | 0 | 1.0000 | b, r -- a | (a)-[r:]-(b) |
| | +----------------+------+---------+-----------------+-------------------+----------------------+---------------------+--------------+
| +AllNodesScan | 35 | 35 | 36 | 1 | 0 | 1.0000 | a | |
+-------------------------+----------------+------+---------+-----------------+-------------------+----------------------+---------------------+--------------+
Total database accesses: 686
Eager Aggregation
The EagerAggregation operator evaluates a grouping expression and uses the result to group rows into different groupings.
For each of these groupings, EagerAggregation will then evaluate all aggregation functions and return the result.
To do this, EagerAggregation, as the name implies, needs to pull in all data eagerly from its source and build up state, which leads to increased memory pressure in the system.
MATCH (l:Location)<-[:WORKS_IN]-(p:Person) RETURN l.name AS location, collect(p.name) AS people
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+-------------------+----------------+------+---------+-----------+------------------+----------------------+
| Operator | Estimated Rows | Rows | DB Hits | Time (ms) | Variables | Other |
+-------------------+----------------+------+---------+-----------+------------------+----------------------+
| +ProduceResults | 4 | 6 | 0 | 0.563 | location, people | |
| | +----------------+------+---------+-----------+------------------+----------------------+
| +EagerAggregation | 4 | 6 | 30 | 0.188 | location, people | location |
| | +----------------+------+---------+-----------+------------------+----------------------+
| +Filter | 15 | 15 | 15 | | anon[19], l, p | p:Person |
| | +----------------+------+---------+-----------+------------------+----------------------+
| +Expand(All) | 15 | 15 | 26 | | anon[19], p -- l | (l)<-[:WORKS_IN]-(p) |
| | +----------------+------+---------+-----------+------------------+----------------------+
| +CacheProperties | 10 | 10 | 20 | | l | cache[l.name] |
| | +----------------+------+---------+-----------+------------------+----------------------+
| +NodeByLabelScan | 10 | 10 | 11 | | l | :Location |
+-------------------+----------------+------+---------+-----------+------------------+----------------------+
Total database accesses: 102
Ordered Aggregation
The OrderedAggregation operator is an optimization of the EagerAggregation operator that takes advantage of the ordering of the incoming rows.
This operator uses lazy evaluation and has a lower memory pressure in the system than the EagerAggregation operator.
MATCH (p:Person) WHERE p.name STARTS WITH 'P' RETURN p.name, count(*) AS count
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+-----------------------------------------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Order | Variables | Other |
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+-----------------------------------------------------------+
| +ProduceResults | 0 | 2 | 0 | 0 | 0 | 0.0000 | p.name ASC | count, p.name | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+-----------------------------------------------------------+
| +OrderedAggregation | 0 | 2 | 0 | 0 | 0 | 0.0000 | p.name ASC | count, p.name | p.name |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+-----------------------------------------------------------+
| +NodeIndexSeekByRange | 0 | 2 | 3 | 0 | 1 | 0.0000 | p.name ASC | p | :Person(name STARTS WITH $` AUTOSTRING0`), cache[p.name] |
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+-----------------------------------------------------------+
Total database accesses: 3
Node Count From Count Store
The NodeCountFromCountStore operator uses the count store to answer questions about node counts.
This is much faster than the EagerAggregation operator which achieves the same result by actually counting.
However, as the count store only stores a limited range of combinations, EagerAggregation will still be used for more complex queries.
For example, we can get counts for all nodes, and nodes with a label, but not nodes with more than one label.
MATCH (p:Person) RETURN count(p) AS people
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+--------------------------+----------------+------+---------+-----------+------------------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Variables | Other |
+--------------------------+----------------+------+---------+-----------+------------------------------------+
| +ProduceResults | 1 | 1 | 0 | people | |
| | +----------------+------+---------+-----------+------------------------------------+
| +NodeCountFromCountStore | 1 | 1 | 1 | people | count( (:Some(Person)) ) AS people |
+--------------------------+----------------+------+---------+-----------+------------------------------------+
Total database accesses: 1
Relationship Count From Count Store
The RelationshipCountFromCountStore operator uses the count store to answer questions about relationship counts.
This is much faster than the EagerAggregation operator which achieves the same result by actually counting.
However, as the count store only stores a limited range of combinations, EagerAggregation will still be used for more complex queries.
For example, we can get counts for all relationships, relationships with a type, relationships with a label on one end, but not relationships with labels on both end nodes.
MATCH (p:Person)-[r:WORKS_IN]->() RETURN count(r) AS jobs
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+----------------------------------+----------------+------+---------+-----------+--------------------------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Variables | Other |
+----------------------------------+----------------+------+---------+-----------+--------------------------------------------+
| +ProduceResults | 1 | 1 | 0 | jobs | |
| | +----------------+------+---------+-----------+--------------------------------------------+
| +RelationshipCountFromCountStore | 1 | 1 | 1 | jobs | count( (:Person)-[:WORKS_IN]->() ) AS jobs |
+----------------------------------+----------------+------+---------+-----------+--------------------------------------------+
Total database accesses: 1
Distinct
The Distinct operator removes duplicate rows from the incoming stream of rows.
To ensure only distinct elements are returned, Distinct will pull in data lazily from its source and build up state.
This may lead to increased memory pressure in the system.
MATCH (l:Location)<-[:WORKS_IN]-(p:Person) RETURN DISTINCT l
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+------------------+----------------+------+---------+-----------+------------------+----------------------+
| Operator | Estimated Rows | Rows | DB Hits | Time (ms) | Variables | Other |
+------------------+----------------+------+---------+-----------+------------------+----------------------+
| +ProduceResults | 14 | 6 | 0 | 0.250 | l | |
| | +----------------+------+---------+-----------+------------------+----------------------+
| +Distinct | 14 | 6 | 0 | 1.476 | l | l |
| | +----------------+------+---------+-----------+------------------+----------------------+
| +Filter | 15 | 15 | 15 | | anon[19], l, p | p:Person |
| | +----------------+------+---------+-----------+------------------+----------------------+
| +Expand(All) | 15 | 15 | 26 | | anon[19], p -- l | (l)<-[:WORKS_IN]-(p) |
| | +----------------+------+---------+-----------+------------------+----------------------+
| +NodeByLabelScan | 10 | 10 | 11 | | l | :Location |
+------------------+----------------+------+---------+-----------+------------------+----------------------+
Total database accesses: 52
Ordered Distinct
The OrderedDistinct operator is an optimization of the Distinct operator that takes advantage of the ordering of the incoming rows.
This operator has a lower memory pressure in the system than the Distinct operator.
MATCH (p:Person) WHERE p.name STARTS WITH 'P' RETURN DISTINCT p.name
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+-----------------------------------------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Order | Variables | Other |
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+-----------------------------------------------------------+
| +ProduceResults | 0 | 2 | 0 | 0 | 0 | 0.0000 | p.name ASC | p.name | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+-----------------------------------------------------------+
| +OrderedDistinct | 0 | 2 | 0 | 0 | 0 | 0.0000 | p.name ASC | p.name | p.name |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+-----------------------------------------------------------+
| +NodeIndexSeekByRange | 0 | 2 | 3 | 0 | 1 | 0.0000 | p.name ASC | p | :Person(name STARTS WITH $` AUTOSTRING0`), cache[p.name] |
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+------------+-----------+-----------------------------------------------------------+
Total database accesses: 3
Filter
The Filter operator filters each row coming from the child operator, only passing through rows that evaluate the predicates to true.
MATCH (p:Person) WHERE p.name =~ '^a.*' RETURN p
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+-----------------+----------------+------+---------+-----------+-----------------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Variables | Other |
+-----------------+----------------+------+---------+-----------+-----------------------------------+
| +ProduceResults | 14 | 0 | 0 | p | |
| | +----------------+------+---------+-----------+-----------------------------------+
| +Filter | 14 | 0 | 0 | p | cache[p.name] =~ $` AUTOSTRING0` |
| | +----------------+------+---------+-----------+-----------------------------------+
| +NodeIndexScan | 14 | 14 | 15 | p | :Person(name), cache[p.name] |
+-----------------+----------------+------+---------+-----------+-----------------------------------+
Total database accesses: 15
Limit
The Limit operator returns the first 'n' rows from the incoming input.
MATCH (p:Person) RETURN p LIMIT 3
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+------------------+----------------+------+---------+-----------+-----------+---------+
| Operator | Estimated Rows | Rows | DB Hits | Time (ms) | Variables | Other |
+------------------+----------------+------+---------+-----------+-----------+---------+
| +ProduceResults | 3 | 3 | 0 | 0.286 | p | |
| | +----------------+------+---------+-----------+-----------+---------+
| +Limit | 3 | 3 | 0 | 1.525 | p | 3 |
| | +----------------+------+---------+-----------+-----------+---------+
| +NodeByLabelScan | 14 | 14 | 15 | 0.164 | p | :Person |
+------------------+----------------+------+---------+-----------+-----------+---------+
Total database accesses: 15
Skip
The Skip operator skips 'n' rows from the incoming rows.
MATCH (p:Person)
RETURN p
ORDER BY p.id
SKIP 1
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+------------------+----------------+------+---------+-----------------+-------------------+----------------------+----------+-----------+---------------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Order | Variables | Other |
+------------------+----------------+------+---------+-----------------+-------------------+----------------------+----------+-----------+---------------+
| +ProduceResults | 14 | 13 | 0 | 2 | 0 | 1.0000 | p.id ASC | p, p.id | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+----------+-----------+---------------+
| +Skip | 14 | 13 | 0 | 0 | 0 | 0.0000 | p.id ASC | p, p.id | $` AUTOINT0` |
| | +----------------+------+---------+-----------------+-------------------+----------------------+----------+-----------+---------------+
| +Sort | 14 | 14 | 0 | 0 | 0 | 0.0000 | p.id ASC | p, p.id | p.id |
| | +----------------+------+---------+-----------------+-------------------+----------------------+----------+-----------+---------------+
| +Projection | 14 | 14 | 14 | 2 | 0 | 1.0000 | | p.id -- p | {p.id : p.id} |
| | +----------------+------+---------+-----------------+-------------------+----------------------+----------+-----------+---------------+
| +NodeByLabelScan | 14 | 14 | 15 | 2 | 0 | 1.0000 | | p | :Person |
+------------------+----------------+------+---------+-----------------+-------------------+----------------------+----------+-----------+---------------+
Total database accesses: 29
Sort
The Sort operator sorts rows by a provided key.
In order to sort the data, all data from the source operator needs to be pulled in eagerly and kept in the query state, which will lead to increased memory pressure in the system.
MATCH (p:Person) RETURN p ORDER BY p.name
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+------------------+----------------+------+---------+-----------+------------+-------------+-------------------+
| Operator | Estimated Rows | Rows | DB Hits | Time (ms) | Order | Variables | Other |
+------------------+----------------+------+---------+-----------+------------+-------------+-------------------+
| +ProduceResults | 14 | 14 | 0 | 1.968 | p.name ASC | p, p.name | |
| | +----------------+------+---------+-----------+------------+-------------+-------------------+
| +Sort | 14 | 14 | 0 | 0.499 | p.name ASC | p, p.name | p.name |
| | +----------------+------+---------+-----------+------------+-------------+-------------------+
| +Projection | 14 | 14 | 28 | | | p.name -- p | {p.name : p.name} |
| | +----------------+------+---------+-----------+------------+-------------+-------------------+
| +NodeByLabelScan | 14 | 14 | 15 | | | p | :Person |
+------------------+----------------+------+---------+-----------+------------+-------------+-------------------+
Total database accesses: 43
Partial Sort
The PartialSort operator is an optimization of the Sort operator that takes advantage of the ordering of the incoming rows.
This operator uses lazy evaluation and has a lower memory pressure in the system than the Sort operator.
Partial sort is only applicable when sorting on multiple columns.
MATCH (p:Person) WHERE p.name STARTS WITH 'P' RETURN p ORDER BY p.name, p.age
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------------------+--------------------+-----------------------------------------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Order | Variables | Other |
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------------------+--------------------+-----------------------------------------------------------+
| +ProduceResults | 0 | 2 | 0 | 2 | 0 | 1.0000 | p.name ASC, p.age ASC | p, p.age, p.name | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------------------+--------------------+-----------------------------------------------------------+
| +PartialSort | 0 | 2 | 0 | 0 | 0 | 0.0000 | p.name ASC, p.age ASC | p, p.age, p.name | p.name; p.age |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------------------+--------------------+-----------------------------------------------------------+
| +Projection | 0 | 2 | 2 | 0 | 0 | 0.0000 | p.name ASC | p.age, p.name -- p | {p.name : cache[p.name], p.age : p.age} |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------------------+--------------------+-----------------------------------------------------------+
| +NodeIndexSeekByRange | 0 | 2 | 3 | 0 | 1 | 0.0000 | p.name ASC | p | :Person(name STARTS WITH $` AUTOSTRING0`), cache[p.name] |
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------------------+--------------------+-----------------------------------------------------------+
Total database accesses: 5
Top
The Top operator returns the first 'n' rows sorted by a provided key. Instead of sorting the entire input, only the top 'n' rows are retained.
MATCH (p:Person) RETURN p ORDER BY p.name LIMIT 2
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+------------------+----------------+------+---------+-----------+------------+-------------+-------------------+
| Operator | Estimated Rows | Rows | DB Hits | Time (ms) | Order | Variables | Other |
+------------------+----------------+------+---------+-----------+------------+-------------+-------------------+
| +ProduceResults | 2 | 2 | 0 | 0.289 | p.name ASC | p, p.name | |
| | +----------------+------+---------+-----------+------------+-------------+-------------------+
| +Top | 2 | 2 | 0 | 1.466 | p.name ASC | p, p.name | p.name; 2 |
| | +----------------+------+---------+-----------+------------+-------------+-------------------+
| +Projection | 14 | 14 | 28 | | | p.name -- p | {p.name : p.name} |
| | +----------------+------+---------+-----------+------------+-------------+-------------------+
| +NodeByLabelScan | 14 | 14 | 15 | | | p | :Person |
+------------------+----------------+------+---------+-----------+------------+-------------+-------------------+
Total database accesses: 43
Partial Top
The PartialTop operator is an optimization of the Top operator that takes advantage of the ordering of the incoming rows.
This operator uses lazy evaluation and has a lower memory pressure in the system than the Top operator.
Partial top is only applicable when sorting on multiple columns.
MATCH (p:Person) WHERE p.name STARTS WITH 'P' RETURN p ORDER BY p.name, p.age LIMIT 2
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------------------+--------------------+-----------------------------------------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Order | Variables | Other |
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------------------+--------------------+-----------------------------------------------------------+
| +ProduceResults | 0 | 2 | 0 | 2 | 0 | 1.0000 | p.name ASC, p.age ASC | p, p.age, p.name | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------------------+--------------------+-----------------------------------------------------------+
| +PartialTop | 0 | 2 | 0 | 0 | 0 | 0.0000 | p.name ASC, p.age ASC | p, p.age, p.name | p.name; p.age; 2 |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------------------+--------------------+-----------------------------------------------------------+
| +Projection | 0 | 2 | 2 | 0 | 0 | 0.0000 | p.name ASC | p.age, p.name -- p | {p.name : cache[p.name], p.age : p.age} |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------------------+--------------------+-----------------------------------------------------------+
| +NodeIndexSeekByRange | 0 | 2 | 3 | 0 | 1 | 0.0000 | p.name ASC | p | :Person(name STARTS WITH $` AUTOSTRING0`), cache[p.name] |
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------------------+--------------------+-----------------------------------------------------------+
Total database accesses: 5
Union
The Union operator concatenates the results from the right child operator with the results from the left child operator.
MATCH (p:Location)
RETURN p.name
UNION ALL
MATCH (p:Country)
RETURN p.name
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+--------------------+----------------+------+---------+-----------------+-------------------+----------------------+---------------------+---------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables | Other |
+--------------------+----------------+------+---------+-----------------+-------------------+----------------------+---------------------+---------------------------+
| +ProduceResults | 20 | 11 | 0 | 0 | 0 | 0.0000 | p.name | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+---------------------+---------------------------+
| +Union | 20 | 11 | 0 | 0 | 0 | 0.0000 | p.name | |
| |\ +----------------+------+---------+-----------------+-------------------+----------------------+---------------------+---------------------------+
| | +Projection | 10 | 1 | 0 | 0 | 0 | 0.0000 | p.name -- p.name, p | { p.name@55 : `p.name`} |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+---------------------+---------------------------+
| | +Projection | 10 | 1 | 1 | 0 | 0 | 0.0000 | p.name -- p | { p.name@115 : `p`.name} |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+---------------------+---------------------------+
| | +NodeByLabelScan | 10 | 1 | 2 | 2 | 0 | 1.0000 | p | :Country |
| | +----------------+------+---------+-----------------+-------------------+----------------------+---------------------+---------------------------+
| +Projection | 10 | 10 | 0 | 0 | 0 | 0.0000 | p.name -- p.name, p | { p.name@55 : `p.name`} |
| | +----------------+------+---------+-----------------+-------------------+----------------------+---------------------+---------------------------+
| +Projection | 10 | 10 | 10 | 2 | 0 | 1.0000 | p.name -- p | { p.name@40 : `p`.name} |
| | +----------------+------+---------+-----------------+-------------------+----------------------+---------------------+---------------------------+
| +NodeByLabelScan | 10 | 10 | 11 | 2 | 0 | 1.0000 | p | :Location |
+--------------------+----------------+------+---------+-----------------+-------------------+----------------------+---------------------+---------------------------+
Total database accesses: 24
Unwind
The Unwind operator returns one row per item in a list.
UNWIND range(1, 5) as value return value
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+-----------------+----------------+------+---------+-----------+-------------------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Variables | Other |
+-----------------+----------------+------+---------+-----------+-------------------------------------+
| +ProduceResults | 10 | 5 | 0 | value | |
| | +----------------+------+---------+-----------+-------------------------------------+
| +Unwind | 10 | 5 | 0 | value | range($` AUTOINT0`, $` AUTOINT1`) |
+-----------------+----------------+------+---------+-----------+-------------------------------------+
Total database accesses: 0
Lock Nodes
The LockNodes operator locks the start and end node when creating a relationship.
MATCH (s:Person {name: 'me'}) MERGE (s)-[:FRIENDS_WITH]->(s)
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+------------------------------+----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Order | Variables | Other |
+------------------------------+----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| +ProduceResults | 1 | 0 | 0 | 0 | 0 | 0.0000 | | anon[40], s | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| +EmptyResult | 1 | 0 | 0 | 0 | 0 | 0.0000 | | anon[40], s | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| +Apply | 1 | 1 | 0 | 0 | 0 | 0.0000 | | anon[40], s | |
| |\ +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | +AntiConditionalApply | 1 | 1 | 0 | 0 | 0 | 0.0000 | | anon[40], s | |
| | |\ +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | | +MergeCreateRelationship | 1 | 1 | 2 | 2 | 0 | 1.0000 | | anon[40] -- s | |
| | | | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | | +Argument | 1 | 1 | 0 | 0 | 0 | 0.0000 | | s | |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | +AntiConditionalApply | 1 | 1 | 0 | 0 | 0 | 0.0000 | | anon[40], s | |
| | |\ +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | | +Optional | 1 | 1 | 0 | 0 | 0 | 0.0000 | | anon[40], s | |
| | | | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | | +Expand(Into) | 0 | 0 | 4 | 1 | 0 | 1.0000 | | anon[40] -- s | (s)-[:FRIENDS_WITH]->(s) |
| | | | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | | +LockNodes | 1 | 1 | 0 | 0 | 0 | 0.0000 | | s | s |
| | | | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | | +Argument | 1 | 1 | 0 | 0 | 0 | 0.0000 | | s | |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | +Optional | 1 | 1 | 0 | 0 | 0 | 0.0000 | | anon[40], s | |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | +Expand(Into) | 0 | 0 | 4 | 3 | 0 | 1.0000 | | anon[40] -- s | (s)-[:FRIENDS_WITH]->(s) |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | +Argument | 1 | 1 | 0 | 0 | 0 | 0.0000 | | s | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| +NodeIndexSeek | 1 | 1 | 2 | 0 | 1 | 0.0000 | s.name ASC | s | :Person(name) |
+------------------------------+----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
Total database accesses: 12
Optional
The Optional operator is used to solve some OPTIONAL MATCH queries.
It will pull data from its source, simply passing it through if any data exists.
However, if no data is returned by its source, Optional will yield a single row with all columns set to null.
MATCH (p:Person {name:'me'}) OPTIONAL MATCH (q:Person {name: 'Lulu'}) RETURN p, q
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+------------------+----------------+------+---------+-----------+------------+-----------+---------------+
| Operator | Estimated Rows | Rows | DB Hits | Time (ms) | Order | Variables | Other |
+------------------+----------------+------+---------+-----------+------------+-----------+---------------+
| +ProduceResults | 1 | 1 | 0 | 0.200 | p.name ASC | p, q | |
| | +----------------+------+---------+-----------+------------+-----------+---------------+
| +Apply | 1 | 1 | 0 | 0.006 | p.name ASC | p -- q | |
| |\ +----------------+------+---------+-----------+------------+-----------+---------------+
| | +Optional | 1 | 1 | 0 | 0.603 | q.name ASC | q | |
| | | +----------------+------+---------+-----------+------------+-----------+---------------+
| | +NodeIndexSeek | 1 | 0 | 1 | 0.477 | q.name ASC | q | :Person(name) |
| | +----------------+------+---------+-----------+------------+-----------+---------------+
| +NodeIndexSeek | 1 | 1 | 2 | 1.213 | p.name ASC | p | :Person(name) |
+------------------+----------------+------+---------+-----------+------------+-----------+---------------+
Total database accesses: 3
Project Endpoints
The ProjectEndpoints operator projects the start and end node of a relationship.
CREATE (n)-[p:KNOWS]->(m) WITH p AS r MATCH (u)-[r]->(v) RETURN u, v
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+---------------------+----------------+------+---------+-----------------+-------------------+----------------------+--------------------+---------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables | Other |
+---------------------+----------------+------+---------+-----------------+-------------------+----------------------+--------------------+---------+
| +ProduceResults | 18 | 1 | 0 | 0 | 0 | 0.0000 | m, n, p, r, u, v | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+--------------------+---------+
| +Apply | 18 | 1 | 0 | 0 | 0 | 0.0000 | m, n, p -- r, u, v | |
| |\ +----------------+------+---------+-----------------+-------------------+----------------------+--------------------+---------+
| | +ProjectEndpoints | 18 | 1 | 0 | 0 | 0 | 0.0000 | u, v -- r | r, u, v |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+--------------------+---------+
| | +Argument | 1 | 1 | 0 | 0 | 0 | 0.0000 | r | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+--------------------+---------+
| +Projection | 1 | 1 | 0 | 0 | 0 | 0.0000 | r -- m, n, p | {r : p} |
| | +----------------+------+---------+-----------------+-------------------+----------------------+--------------------+---------+
| +Create | 1 | 1 | 4 | 0 | 0 | 0.0000 | m, n, p | |
+---------------------+----------------+------+---------+-----------------+-------------------+----------------------+--------------------+---------+
Total database accesses: 4
Projection
For each incoming row, the Projection operator evaluates a set of expressions and produces a row with the results of the expressions.
RETURN 'hello' AS greeting
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+-----------------+----------------+------+---------+-----------+-------------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Variables | Other |
+-----------------+----------------+------+---------+-----------+-------------------------------+
| +ProduceResults | 1 | 1 | 0 | greeting | |
| | +----------------+------+---------+-----------+-------------------------------+
| +Projection | 1 | 1 | 0 | greeting | {greeting : $` AUTOSTRING0`} |
+-----------------+----------------+------+---------+-----------+-------------------------------+
Total database accesses: 0
Empty Row
The EmptyRow operator returns a single row with no columns.
FOREACH (value IN [1,2,3] |
CREATE (:Person {age: value})
)
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-------------------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-------------------+
| +ProduceResults | 1 | 0 | 0 | 0 | 0 | 0.0000 | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------+
| +EmptyResult | 1 | 0 | 0 | 0 | 0 | 0.0000 | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------+
| +Foreach | 1 | 1 | 0 | 0 | 0 | 0.0000 | |
| |\ +----------------+------+---------+-----------------+-------------------+----------------------+-------------------+
| | +Create | 1 | 3 | 9 | 0 | 0 | 0.0000 | anon[36] -- value |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------+
| | +Argument | 1 | 3 | 0 | 0 | 0 | 0.0000 | value |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-------------------+
| +EmptyRow | 1 | 1 | 0 | 0 | 0 | 0.0000 | |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-------------------+
Total database accesses: 9
Procedure Call
The ProcedureCall operator indicates an invocation to a procedure.
CALL db.labels() YIELD label RETURN * ORDER BY label
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+-----------------+----------------+------+---------+-----------+-----------+-----------+----------------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Time (ms) | Order | Variables | Other |
+-----------------+----------------+------+---------+-----------+-----------+-----------+----------------------------------+
| +ProduceResults | 10000 | 4 | 0 | 0.382 | label ASC | label | |
| | +----------------+------+---------+-----------+-----------+-----------+----------------------------------+
| +Sort | 10000 | 4 | 0 | 4.145 | label ASC | label | label |
| | +----------------+------+---------+-----------+-----------+-----------+----------------------------------+
| +ProcedureCall | 10000 | 4 | | 25.988 | | label | db.labels() :: (label :: String) |
+-----------------+----------------+------+---------+-----------+-----------+-----------+----------------------------------+
Total database accesses: ?
Cache Properties
The CacheProperties operator reads nodes and relationship properties and caches them in the current row.
Future accesses to these properties can avoid reading from the store which will speed up the query.
In the plan below we will cache l.name before Expand(All) where there are fewer rows.
MATCH (l:Location)<-[:WORKS_IN]-(p:Person) RETURN l.name AS location, p.name AS name
Compiler CYPHER 4.0
Planner COST
Runtime PIPELINED
Runtime version 4.0
+------------------+----------------+------+---------+----------------------------------+-------------------------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Variables | Other |
+------------------+----------------+------+---------+----------------------------------+-------------------------------------------+
| +ProduceResults | 15 | 15 | 0 | anon[19], l, location, name, p | |
| | +----------------+------+---------+----------------------------------+-------------------------------------------+
| +Projection | 15 | 15 | 30 | location, name -- anon[19], l, p | {location : cache[l.name], name : p.name} |
| | +----------------+------+---------+----------------------------------+-------------------------------------------+
| +Filter | 15 | 15 | 15 | anon[19], l, p | p:Person |
| | +----------------+------+---------+----------------------------------+-------------------------------------------+
| +Expand(All) | 15 | 15 | 26 | anon[19], p -- l | (l)<-[:WORKS_IN]-(p) |
| | +----------------+------+---------+----------------------------------+-------------------------------------------+
| +CacheProperties | 10 | 10 | 20 | l | cache[l.name] |
| | +----------------+------+---------+----------------------------------+-------------------------------------------+
| +NodeByLabelScan | 10 | 10 | 11 | l | :Location |
+------------------+----------------+------+---------+----------------------------------+-------------------------------------------+
Total database accesses: 102
Create Nodes / Relationships
The Create operator is used to create nodes and relationships.
CREATE (max:Person {name: 'Max'}), (chris:Person {name: 'Chris'})
CREATE (max)-[:FRIENDS_WITH]->(chris)
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+----------------------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+----------------------+
| +ProduceResults | 1 | 0 | 0 | 0 | 0 | 0.0000 | anon[79], chris, max |
| | +----------------+------+---------+-----------------+-------------------+----------------------+----------------------+
| +EmptyResult | 1 | 0 | 0 | 0 | 0 | 0.0000 | anon[79], chris, max |
| | +----------------+------+---------+-----------------+-------------------+----------------------+----------------------+
| +Create | 1 | 1 | 8 | 0 | 0 | 0.0000 | anon[79], chris, max |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+----------------------+
Total database accesses: 8
Delete
The Delete operator is used to delete a node or a relationship.
MATCH (me:Person {name: 'me'})-[w:WORKS_IN {duration: 190}]->(london:Location {name: 'London'})
DELETE w
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+-------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------------+-----------------+-----------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Order | Variables | Other |
+-------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------------+-----------------+-----------------------------+
| +ProduceResults | 0 | 0 | 0 | 0 | 0 | 0.0000 | | london, me, w | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------------+-----------------+-----------------------------+
| +EmptyResult | 0 | 0 | 0 | 0 | 0 | 0.0000 | | london, me, w | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------------+-----------------+-----------------------------+
| +Delete | 0 | 1 | 1 | 2 | 0 | 1.0000 | | london, me, w | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------------+-----------------+-----------------------------+
| +Eager | 0 | 1 | 0 | 0 | 0 | 0.0000 | me.name ASC | london, me, w | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------------+-----------------+-----------------------------+
| +Filter | 0 | 1 | 1 | 2 | 0 | 1.0000 | me.name ASC | london, me, w | w.duration = $` AUTOINT1` |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------------+-----------------+-----------------------------+
| +Expand(Into) | 0 | 1 | 4 | 3 | 0 | 1.0000 | me.name ASC | w -- london, me | (me)-[w:WORKS_IN]->(london) |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------------+-----------------+-----------------------------+
| +CartesianProduct | 1 | 1 | 0 | 0 | 0 | 0.0000 | me.name ASC | me -- london | |
| |\ +----------------+------+---------+-----------------+-------------------+----------------------+-----------------+-----------------+-----------------------------+
| | +NodeIndexSeek | 1 | 1 | 2 | 0 | 1 | 0.0000 | london.name ASC | london | :Location(name) |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------------+-----------------+-----------------------------+
| +NodeIndexSeek | 1 | 1 | 2 | 0 | 1 | 0.0000 | me.name ASC | me | :Person(name) |
+-------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------------+-----------------+-----------------------------+
Total database accesses: 10
Detach Delete
The DetachDelete operator is used in all queries containing the DETACH DELETE clause, when deleting nodes and their relationships.
MATCH (p:Person)
DETACH DELETE p
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+---------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables | Other |
+------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+---------+
| +ProduceResults | 14 | 0 | 0 | 0 | 0 | 0.0000 | p | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------+---------+
| +EmptyResult | 14 | 0 | 0 | 0 | 0 | 0.0000 | p | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------+---------+
| +DetachDelete | 14 | 14 | 0 | 48 | 0 | 1.0000 | p | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------+---------+
| +NodeByLabelScan | 14 | 14 | 15 | 2 | 0 | 1.0000 | p | :Person |
+------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+---------+
Total database accesses: 15
Merge Create Node
The MergeCreateNode operator is used when creating a node as a result of a MERGE clause failing to find the node.
MERGE (:Person {name: 'Sally'})
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+------------------+-----------+---------------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Order | Variables | Other |
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+------------------+-----------+---------------+
| +ProduceResults | 1 | 0 | 0 | 0 | 0 | 0.0000 | | anon[7] | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------------+-----------+---------------+
| +EmptyResult | 1 | 0 | 0 | 0 | 0 | 0.0000 | | anon[7] | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------------+-----------+---------------+
| +AntiConditionalApply | 1 | 1 | 0 | 0 | 0 | 0.0000 | | anon[7] | |
| |\ +----------------+------+---------+-----------------+-------------------+----------------------+------------------+-----------+---------------+
| | +MergeCreateNode | 1 | 1 | 3 | 0 | 0 | 0.0000 | | anon[7] | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------------+-----------+---------------+
| +Optional | 1 | 1 | 0 | 0 | 0 | 0.0000 | anon[7].name ASC | anon[7] | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------------+-----------+---------------+
| +NodeIndexSeek | 1 | 0 | 1 | 0 | 1 | 0.0000 | anon[7].name ASC | anon[7] | :Person(name) |
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+------------------+-----------+---------------+
Total database accesses: 4
Merge Create Relationship
The MergeCreateRelationship operator is used when creating a relationship as a result of a MERGE clause failing to find the relationship.
MATCH (s:Person {name: 'Sally'})
MERGE (s)-[:FRIENDS_WITH]->(s)
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+------------------------------+----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Order | Variables | Other |
+------------------------------+----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| +ProduceResults | 1 | 0 | 0 | 0 | 0 | 0.0000 | | anon[43], s | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| +EmptyResult | 1 | 0 | 0 | 0 | 0 | 0.0000 | | anon[43], s | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| +Apply | 1 | 0 | 0 | 0 | 0 | 0.0000 | | anon[43], s | |
| |\ +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | +AntiConditionalApply | 1 | 0 | 0 | 0 | 0 | 0.0000 | | anon[43], s | |
| | |\ +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | | +MergeCreateRelationship | 1 | 0 | 0 | 0 | 0 | 0.0000 | | anon[43] -- s | |
| | | | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | | +Argument | 1 | 0 | 0 | 0 | 0 | 0.0000 | | s | |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | +AntiConditionalApply | 1 | 0 | 0 | 0 | 0 | 0.0000 | | anon[43], s | |
| | |\ +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | | +Optional | 1 | 0 | 0 | 0 | 0 | 0.0000 | | anon[43], s | |
| | | | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | | +Expand(Into) | 0 | 0 | 0 | 0 | 0 | 0.0000 | | anon[43] -- s | (s)-[:FRIENDS_WITH]->(s) |
| | | | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | | +LockNodes | 1 | 0 | 0 | 0 | 0 | 0.0000 | | s | s |
| | | | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | | +Argument | 1 | 0 | 0 | 0 | 0 | 0.0000 | | s | |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | +Optional | 1 | 0 | 0 | 0 | 0 | 0.0000 | | anon[43], s | |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | +Expand(Into) | 0 | 0 | 0 | 0 | 0 | 0.0000 | | anon[43] -- s | (s)-[:FRIENDS_WITH]->(s) |
| | | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| | +Argument | 1 | 0 | 0 | 0 | 0 | 0.0000 | | s | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
| +NodeIndexSeek | 1 | 0 | 1 | 0 | 1 | 0.0000 | s.name ASC | s | :Person(name) |
+------------------------------+----------------+------+---------+-----------------+-------------------+----------------------+------------+---------------+--------------------------+
Total database accesses: 1
Set Labels
The SetLabels operator is used when setting labels on a node.
MATCH (n)
SET n:Person
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| +ProduceResults | 35 | 0 | 0 | 0 | 0 | 0.0000 | n |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| +EmptyResult | 35 | 0 | 0 | 0 | 0 | 0.0000 | n |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| +SetLabels | 35 | 35 | 35 | 2 | 0 | 1.0000 | n |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| +AllNodesScan | 35 | 35 | 36 | 1 | 0 | 1.0000 | n |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+
Total database accesses: 71
Remove Labels
The RemoveLabels operator is used when deleting labels from a node.
MATCH (n)
REMOVE n:Person
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| +ProduceResults | 35 | 0 | 0 | 0 | 0 | 0.0000 | n |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| +EmptyResult | 35 | 0 | 0 | 0 | 0 | 0.0000 | n |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| +RemoveLabels | 35 | 35 | 35 | 2 | 0 | 1.0000 | n |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| +AllNodesScan | 35 | 35 | 36 | 1 | 0 | 1.0000 | n |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+
Total database accesses: 71
Set Node Properties From Map
The SetNodePropertiesFromMap operator is used when setting properties from a map on a node.
MATCH (n)
SET n = {weekday: 'Monday', meal: 'Lunch'}
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+---------------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables |
+---------------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| +ProduceResults | 35 | 0 | 0 | 0 | 0 | 0.0000 | n |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| +EmptyResult | 35 | 0 | 0 | 0 | 0 | 0.0000 | n |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| +SetNodePropertiesFromMap | 35 | 35 | 141 | 3 | 0 | 1.0000 | n |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| +AllNodesScan | 35 | 35 | 36 | 1 | 0 | 1.0000 | n |
+---------------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+
Total database accesses: 177
Set Relationship Properties From Map
The SetRelationshipPropertiesFromMap operator is used when setting properties from a map on a relationship.
MATCH (n)-[r]->(m)
SET r = {weight: 5, unit: 'kg'}
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+-----------------------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+---------------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables | Other |
+-----------------------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+---------------+
| +ProduceResults | 18 | 0 | 0 | 0 | 0 | 0.0000 | m, n, r | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------+---------------+
| +EmptyResult | 18 | 0 | 0 | 0 | 0 | 0.0000 | m, n, r | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------+---------------+
| +SetRelationshipPropertiesFromMap | 18 | 18 | 69 | 0 | 0 | 0.0000 | m, n, r | |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------+---------------+
| +Expand(All) | 18 | 18 | 53 | 22 | 0 | 1.0000 | n, r -- m | (m)<-[r:]-(n) |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------+---------------+
| +AllNodesScan | 35 | 35 | 36 | 1 | 0 | 1.0000 | m | |
+-----------------------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+---------------+
Total database accesses: 158
Set Property
The SetProperty operator is used when setting a property on a node or relationship.
MATCH (n)
SET n.checked = true
Compiler CYPHER 4.0
Planner COST
Runtime SLOTTED
Runtime version 4.0
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| Operator | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| +ProduceResults | 35 | 0 | 0 | 0 | 0 | 0.0000 | n |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| +EmptyResult | 35 | 0 | 0 | 0 | 0 | 0.0000 | n |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| +SetProperty | 35 | 35 | 38 | 1 | 0 | 1.0000 | n |
| | +----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| +AllNodesScan | 35 | 35 | 36 | 1 | 0 | 1.0000 | n |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+
Total database accesses: 74
Create Unique Constraint
The CreateUniqueConstraint operator creates a unique constraint on a property for all nodes having a certain label.
The following query will create a unique constraint with the name uniqueness on the name property of nodes with the Country label.
CREATE CONSTRAINT uniqueness ON (c:Country) ASSERT c.name is UNIQUE
Compiler CYPHER 4.0
Planner ADMINISTRATION
Runtime SCHEMA
Runtime version 4.0
+---------------------------------+------------+
| Operator | Other |
+---------------------------------+------------+
| +CreateUniquePropertyConstraint | uniqueness |
+---------------------------------+------------+
Total database accesses: ?
Drop Unique Constraint
The DropUniqueConstraint operator removes a unique constraint from a property for all nodes having a certain label.
The following query will drop a unique constraint on the name property of nodes with the Country label.
DROP CONSTRAINT ON (c:Country) ASSERT c.name is UNIQUE
Compiler CYPHER 4.0
Planner ADMINISTRATION
Runtime SCHEMA
Runtime version 4.0
+-------------------------------+
| Operator |
+-------------------------------+
| +DropUniquePropertyConstraint |
+-------------------------------+
Total database accesses: ?
Create Node Property Existence Constraint
The CreateNodePropertyExistenceConstraint operator creates an existence constraint with the name existence on a property for all nodes having a certain label.
This will only appear in Enterprise Edition.
CREATE CONSTRAINT existence ON (p:Person) ASSERT exists(p.name)
Compiler CYPHER 4.0
Planner ADMINISTRATION
Runtime SCHEMA
Runtime version 4.0
+----------------------------------------+-----------+
| Operator | Other |
+----------------------------------------+-----------+
| +CreateNodePropertyExistenceConstraint | existence |
+----------------------------------------+-----------+
Total database accesses: ?
Drop Node Property Existence Constraint
The DropNodePropertyExistenceConstraint operator removes an existence constraint from a property for all nodes having a certain label.
This will only appear in Enterprise Edition.
DROP CONSTRAINT ON (p:Person) ASSERT exists(p.name)
Compiler CYPHER 4.0
Planner ADMINISTRATION
Runtime SCHEMA
Runtime version 4.0
+--------------------------------------+
| Operator |
+--------------------------------------+
| +DropNodePropertyExistenceConstraint |
+--------------------------------------+
Total database accesses: ?
Create Node Key Constraint
The CreateNodeKeyConstraint operator creates a node key constraint with the name node_key which ensures
that all nodes with a particular label have a set of defined properties whose combined value is unique, and where all properties in the set are present.
This will only appear in Enterprise Edition.
CREATE CONSTRAINT node_key ON (e:Employee) ASSERT (e.firstname, e.surname) IS NODE KEY
Compiler CYPHER 4.0
Planner ADMINISTRATION
Runtime SCHEMA
Runtime version 4.0
+--------------------------+----------+
| Operator | Other |
+--------------------------+----------+
| +CreateNodeKeyConstraint | node_key |
+--------------------------+----------+
Total database accesses: ?
Drop Node Key Constraint
The DropNodeKeyConstraint operator removes a node key constraint from a set of properties for all nodes having a certain label.
This will only appear in Enterprise Edition.
DROP CONSTRAINT ON (e:Employee) ASSERT (e.firstname, e.surname) IS NODE KEY
Compiler CYPHER 4.0
Planner ADMINISTRATION
Runtime SCHEMA
Runtime version 4.0
+------------------------+
| Operator |
+------------------------+
| +DropNodeKeyConstraint |
+------------------------+
Total database accesses: ?
Create Relationship Property Existence Constraint
The CreateRelationshipPropertyExistenceConstraint operator creates an existence constraint with the name existence on a property for all relationships of a certain type.
This will only appear in Enterprise Edition.
CREATE CONSTRAINT existence ON ()-[l:LIKED]-() ASSERT exists(l.when)
Compiler CYPHER 4.0
Planner ADMINISTRATION
Runtime SCHEMA
Runtime version 4.0
+------------------------------------------------+-----------+
| Operator | Other |
+------------------------------------------------+-----------+
| +CreateRelationshipPropertyExistenceConstraint | existence |
+------------------------------------------------+-----------+
Total database accesses: ?
Drop Relationship Property Existence Constraint
The DropRelationshipPropertyExistenceConstraint operator removes an existence constraint from a property for all relationships of a certain type.
This will only appear in Enterprise Edition.
DROP CONSTRAINT ON ()-[l:LIKED]-() ASSERT exists(l.when)
Compiler CYPHER 4.0
Planner ADMINISTRATION
Runtime SCHEMA
Runtime version 4.0
+----------------------------------------------+
| Operator |
+----------------------------------------------+
| +DropRelationshipPropertyExistenceConstraint |
+----------------------------------------------+
Total database accesses: ?
Drop Constraint by name
The DropConstraint operator removes a constraint using the name of the constraint, no matter the type.
DROP CONSTRAINT name
Compiler CYPHER 4.0
Planner ADMINISTRATION
Runtime SCHEMA
Runtime version 4.0
+-----------------+-------+
| Operator | Other |
+-----------------+-------+
| +DropConstraint | name |
+-----------------+-------+
Total database accesses: ?
Create Index
The CreateIndex operator creates an index on a property for all nodes having a certain label.
The following query will create an index with the name my_index on the name property of nodes with the Country label.
CREATE INDEX my_index FOR (c:Country) ON (c.name)
Compiler CYPHER 4.0
Planner ADMINISTRATION
Runtime SCHEMA
Runtime version 4.0
+--------------+----------+
| Operator | Other |
+--------------+----------+
| +CreateIndex | my_index |
+--------------+----------+
Total database accesses: ?
Drop Index
The DropIndex operator removes an index from a property for all nodes having a certain label.
The following query will drop an index on the name property of nodes with the Country label.
DROP INDEX ON :Country(name)
Compiler CYPHER 4.0
Planner ADMINISTRATION
Runtime SCHEMA
Runtime version 4.0
+------------+
| Operator |
+------------+
| +DropIndex |
+------------+
Total database accesses: ?
Drop Index by name
The DropIndex operator removes an index using the name of the index.
DROP INDEX name
Compiler CYPHER 4.0
Planner ADMINISTRATION
Runtime SCHEMA
Runtime version 4.0
+------------+-------+
| Operator | Other |
+------------+-------+
| +DropIndex | name |
+------------+-------+
Total database accesses: ?