|
4 | 4 |
|
5 | 5 | Understanding the roles of different operators in an execution plan can be an important step in making queries more efficient. |
6 | 6 | This 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]. |
8 | 8 |
|
9 | 9 | The operators are grouped into categories based on the role they fulfill in executing a Cypher query: |
10 | 10 |
|
@@ -1187,7 +1187,7 @@ Total database accesses: 1, total allocated memory: 184 |
1187 | 1187 | ====== |
1188 | 1188 |
|
1189 | 1189 | [[query-plan-directed-all-relationships-scan]] |
1190 | | -=== Directed All Relationships Scan |
| 1190 | +=== Directed All Relationships Scan |
1191 | 1191 |
|
1192 | 1192 | The `DirectedAllRelationshipsScan` operator fetches all relationships and their start and end nodes in the database. |
1193 | 1193 |
|
@@ -2611,7 +2611,7 @@ Allows Cypher to use xref:indexes/search-performance-indexes/using-indexes.adoc# |
2611 | 2611 | .Query |
2612 | 2612 | [source, cypher] |
2613 | 2613 | ---- |
2614 | | -PROFILE |
| 2614 | +PROFILE |
2615 | 2615 | WITH "Person" AS label |
2616 | 2616 | MATCH (people:$(label)) |
2617 | 2617 | RETURN people.name |
@@ -2657,7 +2657,7 @@ Allows Cypher to use xref:indexes/search-performance-indexes/using-indexes.adoc# |
2657 | 2657 | .Query |
2658 | 2658 | [source, cypher] |
2659 | 2659 | ---- |
2660 | | -PROFILE |
| 2660 | +PROFILE |
2661 | 2661 | WITH "FRIENDS_WITH" AS relType |
2662 | 2662 | MATCH ()-[r:$(relType)]->() |
2663 | 2663 | RETURN count(r) as relCount |
@@ -2703,7 +2703,7 @@ Allows Cypher to use xref:indexes/search-performance-indexes/using-indexes.adoc# |
2703 | 2703 | .Query |
2704 | 2704 | [source, cypher] |
2705 | 2705 | ---- |
2706 | | -PROFILE |
| 2706 | +PROFILE |
2707 | 2707 | WITH "FRIENDS_WITH" AS relType |
2708 | 2708 | MATCH ()-[r:$(relType)]-() |
2709 | 2709 | RETURN count(r) as relCount |
@@ -6087,6 +6087,57 @@ Total database accesses: 15, total allocated memory: 2232 |
6087 | 6087 |
|
6088 | 6088 | ====== |
6089 | 6089 |
|
| 6090 | + |
| 6091 | +[role=label--new-2025.11] |
| 6092 | +[[query-plan-merge-unique-node]] |
| 6093 | +=== Merge Unique Node |
| 6094 | + |
| 6095 | +//// |
| 6096 | +[source, cypher, role=test-setup] |
| 6097 | +---- |
| 6098 | +CREATE CONSTRAINT team_name IF NOT EXISTS FOR (t:Team) REQUIRE (t.name) IS UNIQUE |
| 6099 | +---- |
| 6100 | +//// |
| 6101 | + |
| 6102 | +The `MergeUniqueNode` operator is similar to the xref:planning-and-tuning/operators/operators-detail.adoc#query-plan-merge[`Merge`] operator, but is used when there is a property uniqueness constraint on the property used in the `MERGE` statement. |
| 6103 | + |
| 6104 | +.MergeUniqueNode |
| 6105 | +====== |
| 6106 | +
|
| 6107 | +.Query |
| 6108 | +[source, cypher] |
| 6109 | +---- |
| 6110 | +PROFILE |
| 6111 | +MERGE (t:Team {name: 'Engineering'}) |
| 6112 | +---- |
| 6113 | +
|
| 6114 | +.Query Plan |
| 6115 | +[role="queryplan", subs="attributes+"] |
| 6116 | +---- |
| 6117 | +Planner COST |
| 6118 | +
|
| 6119 | +Runtime PIPELINED |
| 6120 | +
|
| 6121 | +Runtime version {neo4j-version} |
| 6122 | +
|
| 6123 | +Batch size 128 |
| 6124 | +
|
| 6125 | ++------------------+----+---------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+--------------+ |
| 6126 | +| Operator | Id | Details | Estimated Rows | Rows | DB Hits | Memory (Bytes) | Page Cache Hits/Misses | Time (ms) | Pipeline | Indexes Used | |
| 6127 | ++------------------+----+---------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+--------------+ |
| 6128 | +| +ProduceResults | 0 | | 1 | 0 | 0 | 0 | | | | | |
| 6129 | +| | +----+---------------------------------------------------+----------------+------+---------+----------------+ | | +--------------+ |
| 6130 | +| +EmptyResult | 1 | | 1 | 0 | 0 | | | | | | |
| 6131 | +| | +----+---------------------------------------------------+----------------+------+---------+----------------+ | | +--------------+ |
| 6132 | +| +MergeUniqueNode | 2 | UNIQUE t:Team(name) WHERE name = $autostring_0, | 1 | 1 | 2 | 248 | 1/0 | 2.922 | Fused in Pipeline 0 | team_name: 1 | |
| 6133 | ++------------------+----+---------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+--------------+ |
| 6134 | +
|
| 6135 | +Total database accesses: 2, total allocated memory: 312 |
| 6136 | +---- |
| 6137 | +
|
| 6138 | +====== |
| 6139 | + |
| 6140 | + |
6090 | 6141 | [role=label--new-2025.09] |
6091 | 6142 | [[query-plan-lock-nodes]] |
6092 | 6143 | === Lock Nodes |
|
0 commit comments