44
55Understanding the roles of different operators in an execution plan can be an important step in making queries more efficient.
66This page contains details and examples for each of the operators used by the Cypher planner.
7- For an overview of how the Cypher planner uses operators, see xref:planning-and-tuning/execution-plans.adoc#reading-execution-plans[ Understanding execution plans -> Reading execution plans].
7+ For an overview of how the Cypher planner uses operators, see xref:planning-and-tuning/execution-plans.adoc#reading-execution-plans[ Understanding execution plans -> Reading execution plans].
88
99The operators are grouped into categories based on the role they fulfill in executing a Cypher query:
1010
@@ -1180,7 +1180,7 @@ Total database accesses: 1, total allocated memory: 184
11801180======
11811181
11821182[[query-plan-directed-all-relationships-scan]]
1183- === Directed All Relationships Scan
1183+ === Directed All Relationships Scan
11841184
11851185The `DirectedAllRelationshipsScan` operator fetches all relationships and their start and end nodes in the database.
11861186
@@ -2588,7 +2588,7 @@ Allows Cypher to use xref:indexes/search-performance-indexes/using-indexes.adoc#
25882588.Query
25892589[source, cypher]
25902590----
2591- PROFILE
2591+ PROFILE
25922592WITH "Person" AS label
25932593MATCH (people:$(label))
25942594RETURN people.name
@@ -2634,7 +2634,7 @@ Allows Cypher to use xref:indexes/search-performance-indexes/using-indexes.adoc#
26342634.Query
26352635[source, cypher]
26362636----
2637- PROFILE
2637+ PROFILE
26382638WITH "FRIENDS_WITH" AS relType
26392639MATCH ()-[r:$(relType)]->()
26402640RETURN count(r) as relCount
@@ -2680,7 +2680,7 @@ Allows Cypher to use xref:indexes/search-performance-indexes/using-indexes.adoc#
26802680.Query
26812681[source, cypher]
26822682----
2683- PROFILE
2683+ PROFILE
26842684WITH "FRIENDS_WITH" AS relType
26852685MATCH ()-[r:$(relType)]-()
26862686RETURN count(r) as relCount
@@ -3379,23 +3379,23 @@ Runtime version {neo4j-version}
33793379
33803380Batch size 128
33813381
3382- +-----------------+----+-------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+
3383- | Operator | Id | Details | Estimated Rows | Rows | DB Hits | Memory (Bytes) | Page Cache Hits/Misses | Time (ms) | Pipeline |
3384- +-----------------+----+-------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+
3385- | +ProduceResults | 0 | | 1 | 0 | 0 | | | | |
3386- | | +----+-------------------------------------------------------+----------------+------+---------+----------------+ | | |
3387- | +EmptyResult | 1 | | 1 | 0 | 0 | | | | |
3388- | | +----+-------------------------------------------------------+----------------+------+---------+----------------+ | | |
3389- | +Apply | 2 | | 1 | 1 | 0 | | | | |
3390- | |\ +----+-------------------------------------------------------+----------------+------+---------+----------------+ | | |
3391- | | +LockingMerge | 3 | CREATE (s)-[anon_0:FRIENDS_WITH]->(s), LOCK(s) | 1 | 1 | 1 | | | | |
3392- | | | +----+-------------------------------------------------------+----------------+------+---------+----------------+ | | |
3393- | | +Expand(Into) | 4 | (s)-[anon_0:FRIENDS_WITH]->(s) | 0 | 0 | 10 | 904 | | | |
3394- | | | +----+-------------------------------------------------------+----------------+------+---------+----------------+ | | |
3395- | | +Argument | 5 | s | 1 | 3 | 0 | 2280 | 2 /0 | 0.460 | Fused in Pipeline 1 |
3396- | | +----+-------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+
3397- | +NodeIndexSeek | 6 | RANGE INDEX s:Person(name) WHERE name = $autostring_0 | 1 | 1 | 2 | 376 | 1/0 | 0.211 | In Pipeline 0 |
3398- +-----------------+----+-------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+
3382+ +-------------------- +----+-------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+- ---------------------+
3383+ | Operator | Id | Details | Estimated Rows | Rows | DB Hits | Memory (Bytes) | Page Cache Hits/Misses | Time (ms) | Pipeline | Indexes Used |
3384+ +-------------------- +----+-------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+- ---------------------+
3385+ | +ProduceResults | 0 | | 1 | 0 | 0 | 0 | | | | |
3386+ | | +----+-------------------------------------------------------+----------------+------+---------+----------------+ | | +----------------------+
3387+ | +EmptyResult | 1 | | 1 | 0 | 0 | | | | | |
3388+ | | +----+-------------------------------------------------------+----------------+------+---------+----------------+ | | +----------------------+
3389+ | +Apply | 2 | | 1 | 0 | 0 | | | | | |
3390+ | |\ +----+-------------------------------------------------------+----------------+------+---------+----------------+ | | +----------------------+
3391+ | | +ArgumentTracker | 6 | | 1 | 0 | 0 | 736 | | | | |
3392+ | | | +----+-------------------------------------------------------+----------------+------+---------+----------------+ | | +----------------------+
3393+ | | +MergeInto | 3 | MERGE (s)-[anon_0:FRIENDS_WITH]->(s) | 1 | 1 | 1 | | | | | |
3394+ | | | +----+-------------------------------------------------------+----------------+------+---------+----------------+ | | +----------------------+
3395+ | | +Argument | 4 | s | 1 | 1 | 0 | 2288 | 1 /0 | 1.626 | Fused in Pipeline 1 | |
3396+ | | +----+-------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+- ---------------------+
3397+ | +NodeIndexSeek | 5 | RANGE INDEX s:Person(name) WHERE name = $autostring_0 | 1 | 1 | 2 | 376 | 1/0 | 0.300 | In Pipeline 0 | range_person_name: 1 |
3398+ +-------------------- +----+-------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+- ---------------------+
33993399
34003400Total database accesses: 15, total allocated memory: 2232
34013401----
@@ -6022,7 +6022,7 @@ The `LockingMerge` operator is similar to the xref:planning-and-tuning/operators
60226022----
60236023PROFILE
60246024MATCH (s:Person {name: 'me'})
6025- MERGE (s)-[:FRIENDS_WITH]->(s )
6025+ MERGE (s)-[:FRIENDS_WITH]->(:Person {name: 'you'} )
60266026----
60276027
60286028.Query Plan
@@ -6036,25 +6036,25 @@ Runtime version {neo4j-version}
60366036
60376037Batch size 128
60386038
6039- +-----------------+----+-------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+
6040- | Operator | Id | Details | Estimated Rows | Rows | DB Hits | Memory (Bytes) | Page Cache Hits/Misses | Time (ms) | Pipeline |
6041- +-----------------+----+-------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+
6042- | +ProduceResults | 0 | | 1 | 0 | 0 | | | | |
6043- | | +----+-------------------------------------------------------+----------------+------+---------+----------------+ | | |
6044- | +EmptyResult | 1 | | 1 | 0 | 0 | | | | |
6045- | | +----+-------------------------------------------------------+----------------+------+---------+----------------+ | | |
6046- | +Apply | 2 | | 1 | 1 | 0 | | | | |
6047- | |\ +----+-------------------------------------------------------+----------------+------+---------+----------------+ | | |
6048- | | +LockingMerge | 3 | CREATE (s)-[anon_0:FRIENDS_WITH]->(s ), LOCK(s) | 1 | 1 | 1 | | | | |
6049- | | | +----+-------------------------------------------------------+----------------+------+---------+----------------+ | | |
6050- | | +Expand(Into) | 4 | (s)-[anon_0:FRIENDS_WITH]->(s ) | 0 | 0 | 10 | 904 | | | |
6051- | | | +----+-------------------------------------------------------+----------------+------+---------+----------------+ | | |
6052- | | +Argument | 5 | s | 1 | 3 | 0 | 2280 | 2/0 | 0.460 | Fused in Pipeline 1 |
6053- | | +----+-------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+
6054- | +NodeIndexSeek | 6 | RANGE INDEX s:Person(name) WHERE name = $autostring_0 | 1 | 1 | 2 | 376 | 1/0 | 0.211 | In Pipeline 0 |
6055- +-----------------+----+-------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+
6039+ +------------------ +----+-------------------------------------------------------------------------------------------- +----------------+------+---------+----------------+------------------------+-----------+---------------------+- ---------------------+
6040+ | Operator | Id | Details | Estimated Rows | Rows | DB Hits | Memory (Bytes) | Page Cache Hits/Misses | Time (ms) | Pipeline | Indexes Used |
6041+ +------------------ +----+-------------------------------------------------------------------------------------------- +----------------+------+---------+----------------+------------------------+-----------+---------------------+- ---------------------+
6042+ | +ProduceResults | 0 | | 0 | 0 | 0 | | | | | |
6043+ | | +----+-------------------------------------------------------------------------------------------- +----------------+------+---------+----------------+ | | +----------------------+
6044+ | +EmptyResult | 1 | | 0 | 0 | 0 | | | | | |
6045+ | | +----+-------------------------------------------------------------------------------------------- +----------------+------+---------+----------------+ | | +----------------------+
6046+ | +Apply | 2 | | 0 | 0 | 0 | | | | | |
6047+ | |\ +----+-------------------------------------------------------------------------------------------- +----------------+------+---------+----------------+ | | +----------------------+
6048+ | | +LockingMerge | 3 | CREATE (anon_1:Person {name: $autostring_1}), ( s)-[anon_0:FRIENDS_WITH]->(anon_1 ), LOCK(s) | 0 | 0 | 0 | | | | | |
6049+ | | | +----+-------------------------------------------------------------------------------------------- +----------------+------+---------+----------------+ | | +----------------------+
6050+ | | +Expand(Into) | 4 | (s)-[anon_0:FRIENDS_WITH]->(anon_1 ) | 0 | 0 | 0 | | | | | |
6051+ | | | +----+-------------------------------------------------------------------------------------------- +----------------+------+---------+----------------+ | | +----------------------+
6052+ | | +NodeIndexSeek | 5 | RANGE INDEX anon_1:Person(name) WHERE name = $autostring_1 | 0 | 0 | 0 | 128 | 0/0 | 0.000 | Fused in Pipeline 1 | |
6053+ | | +----+-------------------------------------------------------------------------------------------- +----------------+------+---------+----------------+------------------------+-----------+---------------------+- ---------------------+
6054+ | +NodeIndexSeek | 6 | RANGE INDEX s:Person(name) WHERE name = $autostring_0 | 0 | 0 | 1 | 376 | 1/0 | 0.186 | In Pipeline 0 | range_person_name: 1 |
6055+ +------------------ +----+-------------------------------------------------------------------------------------------- +----------------+------+---------+----------------+------------------------+-----------+---------------------+- ---------------------+
60566056
6057- Total database accesses: 15 , total allocated memory: 2232
6057+ Total database accesses: 1 , total allocated memory: 584
60586058----
60596059
60606060======
@@ -7297,4 +7297,4 @@ Runtime version {neo4j-version}
72977297Total database accesses: 0, total allocated memory: 64
72987298----
72997299
7300- ======
7300+ ======
0 commit comments