From 721f5ebfb60738ffd9937aa5eb8f1b9dd8fda1db Mon Sep 17 00:00:00 2001 From: Pontus Melke Date: Thu, 20 Nov 2025 13:03:51 +0100 Subject: [PATCH 1/3] Add documentation for MergeUniqueNode --- .../operators/operators-detail.adoc | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/modules/ROOT/pages/planning-and-tuning/operators/operators-detail.adoc b/modules/ROOT/pages/planning-and-tuning/operators/operators-detail.adoc index 2c6631919..9ee522595 100644 --- a/modules/ROOT/pages/planning-and-tuning/operators/operators-detail.adoc +++ b/modules/ROOT/pages/planning-and-tuning/operators/operators-detail.adoc @@ -6056,6 +6056,54 @@ Total database accesses: 15, total allocated memory: 2232 ====== +[[query-plan-merge-unique-node]] +=== Merge Unique Node + +//// +[source, cypher, role=test-setup] +---- +CREATE CONSTRAINT team_name IF NOT EXISTS FOR (t:Team) REQUIRE (t.name) IS UNIQUE +---- +//// + +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. + +.MergeUniqueNode +====== + +.Query +[source, cypher] +---- +PROFILE +MERGE (t:Team {name: 'Engineering'} +---- + +.Query Plan +[role="queryplan", subs="attributes+"] +---- +Planner COST + +Runtime PIPELINED + +Runtime version {neo4j-version} + +Batch size 128 + ++------------------+----+---------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+--------------+ +| Operator | Id | Details | Estimated Rows | Rows | DB Hits | Memory (Bytes) | Page Cache Hits/Misses | Time (ms) | Pipeline | Indexes Used | ++------------------+----+---------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+--------------+ +| +ProduceResults | 0 | | 1 | 0 | 0 | 0 | | | | | +| | +----+---------------------------------------------------+----------------+------+---------+----------------+ | | +--------------+ +| +EmptyResult | 1 | | 1 | 0 | 0 | | | | | | +| | +----+---------------------------------------------------+----------------+------+---------+----------------+ | | +--------------+ +| +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 | ++------------------+----+---------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+--------------+ + +Total database accesses: 2, total allocated memory: 312 +---- + +====== + [[query-plan-locking-merge]] === Locking Merge From afc4c910cd394dac25467713911bfd19afce5114 Mon Sep 17 00:00:00 2001 From: Stefano Ottolenghi Date: Thu, 20 Nov 2025 15:17:08 +0100 Subject: [PATCH 2/3] fix query --- .../pages/planning-and-tuning/operators/operators-detail.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/planning-and-tuning/operators/operators-detail.adoc b/modules/ROOT/pages/planning-and-tuning/operators/operators-detail.adoc index 9ee522595..b3cdbf717 100644 --- a/modules/ROOT/pages/planning-and-tuning/operators/operators-detail.adoc +++ b/modules/ROOT/pages/planning-and-tuning/operators/operators-detail.adoc @@ -6075,7 +6075,7 @@ The `MergeUniqueNode` operator is similar to the xref:planning-and-tuning/operat [source, cypher] ---- PROFILE -MERGE (t:Team {name: 'Engineering'} +MERGE (t:Team {name: 'Engineering'}) ---- .Query Plan From 7c0a5942164630eb47a46557505b334319b3815a Mon Sep 17 00:00:00 2001 From: Stefano Ottolenghi Date: Thu, 20 Nov 2025 16:45:16 +0100 Subject: [PATCH 3/3] formatting --- .../pages/planning-and-tuning/operators/operators-detail.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/planning-and-tuning/operators/operators-detail.adoc b/modules/ROOT/pages/planning-and-tuning/operators/operators-detail.adoc index b3cdbf717..c2756a4f5 100644 --- a/modules/ROOT/pages/planning-and-tuning/operators/operators-detail.adoc +++ b/modules/ROOT/pages/planning-and-tuning/operators/operators-detail.adoc @@ -6066,7 +6066,7 @@ CREATE CONSTRAINT team_name IF NOT EXISTS FOR (t:Team) REQUIRE (t.name) IS UNIQU ---- //// -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. +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. .MergeUniqueNode ======