Skip to content

Commit 890d451

Browse files
Add documentation for MergeUniqueNode (#1428)
Co-authored-by: Stefano Ottolenghi <[email protected]>
1 parent 03bb299 commit 890d451

File tree

1 file changed

+56
-5
lines changed

1 file changed

+56
-5
lines changed

modules/ROOT/pages/planning-and-tuning/operators/operators-detail.adoc

Lines changed: 56 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Understanding the roles of different operators in an execution plan can be an important step in making queries more efficient.
66
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].
88

99
The operators are grouped into categories based on the role they fulfill in executing a Cypher query:
1010

@@ -1187,7 +1187,7 @@ Total database accesses: 1, total allocated memory: 184
11871187
======
11881188

11891189
[[query-plan-directed-all-relationships-scan]]
1190-
=== Directed All Relationships Scan
1190+
=== Directed All Relationships Scan
11911191

11921192
The `DirectedAllRelationshipsScan` operator fetches all relationships and their start and end nodes in the database.
11931193

@@ -2611,7 +2611,7 @@ Allows Cypher to use xref:indexes/search-performance-indexes/using-indexes.adoc#
26112611
.Query
26122612
[source, cypher]
26132613
----
2614-
PROFILE
2614+
PROFILE
26152615
WITH "Person" AS label
26162616
MATCH (people:$(label))
26172617
RETURN people.name
@@ -2657,7 +2657,7 @@ Allows Cypher to use xref:indexes/search-performance-indexes/using-indexes.adoc#
26572657
.Query
26582658
[source, cypher]
26592659
----
2660-
PROFILE
2660+
PROFILE
26612661
WITH "FRIENDS_WITH" AS relType
26622662
MATCH ()-[r:$(relType)]->()
26632663
RETURN count(r) as relCount
@@ -2703,7 +2703,7 @@ Allows Cypher to use xref:indexes/search-performance-indexes/using-indexes.adoc#
27032703
.Query
27042704
[source, cypher]
27052705
----
2706-
PROFILE
2706+
PROFILE
27072707
WITH "FRIENDS_WITH" AS relType
27082708
MATCH ()-[r:$(relType)]-()
27092709
RETURN count(r) as relCount
@@ -6087,6 +6087,57 @@ Total database accesses: 15, total allocated memory: 2232
60876087
60886088
======
60896089

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+
60906141
[role=label--new-2025.09]
60916142
[[query-plan-lock-nodes]]
60926143
=== Lock Nodes

0 commit comments

Comments
 (0)