From 525c906e48cc8992e4c6fb6ecf7fad83059bf726 Mon Sep 17 00:00:00 2001 From: Pontus Melke Date: Fri, 29 Aug 2025 11:13:39 +0200 Subject: [PATCH 1/3] Add documentation for new LockNodes operator --- .../operators/operators-detail.adoc | 78 +++++++++++++++++++ 1 file changed, 78 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 b04716780..7475f2920 100644 --- a/modules/ROOT/pages/planning-and-tuning/operators/operators-detail.adoc +++ b/modules/ROOT/pages/planning-and-tuning/operators/operators-detail.adoc @@ -6059,6 +6059,84 @@ Total database accesses: 15, total allocated memory: 2232 ====== +[[query-plan-lock-nodes]] +=== Lock Nodes + +The `LockNodes` operator is sometimes used in conjunction with xref:planning-and-tuning/operators/operators-detail.adoc#query-plan-locking-merge[`LockingMerge`] operator to lock nodes. + + +.LockingMerge +====== + +.Query +[source, cypher] +---- +PROFILE +MATCH (s:Person {name: 'me'}) +MERGE (s)-[:FRIENDS_WITH]->(t:Person {size: size([()-->()|1])}) +---- + +.Query Plan +[role="queryplan", subs="attributes+"] +---- +Cypher 5 + +Planner COST + +Runtime PIPELINED + +Runtime version DEV + +Batch size 4 + ++----------------------------------------+----+------------------------------------------------------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+ +| Operator | Id | Details | Estimated Rows | Rows | DB Hits | Memory (Bytes) | Page Cache Hits/Misses | Time (ms) | Pipeline | ++----------------------------------------+----+------------------------------------------------------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+ +| +ProduceResults | 0 | | 1 | 0 | 0 | 0 | 0/0 | 0.018 | | +| | +----+------------------------------------------------------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+ | +| +EmptyResult | 1 | | 1 | 0 | 0 | | 0/0 | 0.016 | In Pipeline 7 | +| | +----+------------------------------------------------------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+ +| +Apply | 2 | | 1 | 0 | 0 | | 0/0 | | | +| |\ +----+------------------------------------------------------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+ +| | +ArgumentTracker | 19 | | 1 | 0 | 0 | 240 | 0/0 | 0.000 | | +| | | +----+------------------------------------------------------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+ | +| | +LockingMerge | 3 | CREATE (t:Person {size: COUNT { MATCH (`anon_2`)-[`anon_3`]->(`anon_4`) RETURN $`autoint_1` AS ` | 1 | 1 | 3 | 400 | 0/0 | 15.340 | In Pipeline 7 | +| | | | | anon_0` }}), (s)-[anon_1:FRIENDS_WITH]->(t), LOCK(s) | | | | | | | | +| | | +----+------------------------------------------------------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+ +| | +AntiConditionalApply | 18 | | | 0 | 0 | 384 | | 0.010 | In Pipeline 6 | +| | |\ +----+------------------------------------------------------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+ +| | | +Filter | 17 | t.size = anon_5 AND t:Person | 0 | 0 | 4 | | | | | +| | | | +----+------------------------------------------------------------------------------------------------------+----------------+------+---------+----------------+ | | | +| | | +Apply | 16 | | 1 | 2 | 0 | | | | | +| | | |\ +----+------------------------------------------------------------------------------------------------------+----------------+------+---------+----------------+ | | | +| | | | +RelationshipCountFromCountStore | 15 | count( ()-[]->() ) AS anon_5 | 1 | 2 | 2 | 608 | 0/0 | 0.113 | Fused in Pipeline 5 | +| | | | +----+------------------------------------------------------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+ +| | | +Expand(All) | 14 | (s)-[anon_1:FRIENDS_WITH]->(t) | 1 | 2 | 3 | | | | | +| | | | +----+------------------------------------------------------------------------------------------------------+----------------+------+---------+----------------+ | | | +| | | +LockNodes | 13 | s | 1 | 1 | 0 | | | | | +| | | | +----+------------------------------------------------------------------------------------------------------+----------------+------+---------+----------------+ | | | +| | | +Argument | 12 | s | 1 | 1 | 0 | 584 | 0/0 | 1.494 | Fused in Pipeline 4 | +| | | +----+------------------------------------------------------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+ +| | +Optional | 11 | s | 0 | 1 | 0 | 528 | 0/0 | 2.057 | In Pipeline 3 | +| | | +----+------------------------------------------------------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+ +| | +Filter | 5 | t.size = anon_5 AND t:Person | 0 | 0 | 4 | | | | | +| | | +----+------------------------------------------------------------------------------------------------------+----------------+------+---------+----------------+ | | | +| | +Apply | 6 | | 1 | 2 | 0 | | | | | +| | |\ +----+------------------------------------------------------------------------------------------------------+----------------+------+---------+----------------+ | | | +| | | +RelationshipCountFromCountStore | 7 | count( ()-[]->() ) AS anon_5 | 1 | 2 | 2 | 528 | 0/0 | 4.220 | Fused in Pipeline 2 | +| | | +----+------------------------------------------------------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+ +| | +Expand(All) | 8 | (s)-[anon_1:FRIENDS_WITH]->(t) | 1 | 2 | 3 | | | | | +| | | +----+------------------------------------------------------------------------------------------------------+----------------+------+---------+----------------+ | | | +| | +Argument | 9 | s | 1 | 1 | 0 | 432 | 1/0 | 0.184 | Fused in Pipeline 1 | +| | +----+------------------------------------------------------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+ +| +NodeIndexSeek | 10 | RANGE INDEX s:Person(name) WHERE name = $autostring_0 | 1 | 1 | 2 | 376 | 0/1 | 9.263 | In Pipeline 0 | ++----------------------------------------+----+------------------------------------------------------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+ + +Total database accesses: 23, total allocated memory: 3248 +---- + +====== + [[query-plan-foreach]] From 2a495278614cbfb37689dbc6f393cb1c0afafb68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20Pryce-=C3=85klundh?= <112686610+JPryce-Aklundh@users.noreply.github.com> Date: Wed, 3 Sep 2025 09:55:19 +0200 Subject: [PATCH 2/3] version info and entry on operators overview --- ...ions-additions-removals-compatibility.adoc | 20 +++++++++++++++++++ .../planning-and-tuning/operators/index.adoc | 7 +++++++ .../operators/operators-detail.adoc | 5 ++--- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc b/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc index 572c68093..a72a07534 100644 --- a/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc +++ b/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc @@ -22,6 +22,26 @@ Cypher 25 was introduced in Neo4j 2025.06 and can only be used on Neo4j 2025.06+ Features removed in Cypher 25 are still available on Neo4j 2025.06+ databases either by prepending a query with `CYPHER 5` or by having Cypher 5 as the default language for the database. For more information, see xref:queries/select-version.adoc[]. +[[cypher-deprecations-additions-removals-2025.09]] +== Neo4j 2025.09 + +=== New in Cypher 25 + +[cols="2", options="header"] +|=== +| Feature +| Details + +a| +label:functionality[] +label:new[] + +New operator: `LockNodes` + + +a| Introduced xref::planning-and-tuning/operators/operators-detail.adoc#query-plan-lock-nodes[`LockNodes`] operator, sometimes used in conjunction with the `LockingMerge` operator to lock nodes. +|=== + [[cypher-deprecations-additions-removals-2025.08]] == Neo4j 2025.08 diff --git a/modules/ROOT/pages/planning-and-tuning/operators/index.adoc b/modules/ROOT/pages/planning-and-tuning/operators/index.adoc index dcc7a393b..146bfb5b8 100644 --- a/modules/ROOT/pages/planning-and-tuning/operators/index.adoc +++ b/modules/ROOT/pages/planning-and-tuning/operators/index.adoc @@ -345,6 +345,13 @@ Tests for the presence of a pattern predicate in queries containing multiple pat | | +| xref::planning-and-tuning/operators/operators-detail.adoc#query-plan-lock-nodes[LockNodes] +| Sometimes used in conjunction with the xref:planning-and-tuning/operators/operators-detail.adoc#query-plan-locking-merge[`LockingMerge`] operator to lock nodes. +| +| +| label:new[Introduced in Neo4j 2025.09] + + | xref::planning-and-tuning/operators/operators-detail.adoc#query-plan-merge[Merge] | The `Merge` operator will either read or create nodes and/or relationships. | 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 7475f2920..c9ed22ea6 100644 --- a/modules/ROOT/pages/planning-and-tuning/operators/operators-detail.adoc +++ b/modules/ROOT/pages/planning-and-tuning/operators/operators-detail.adoc @@ -6059,10 +6059,11 @@ Total database accesses: 15, total allocated memory: 2232 ====== +[role=label--new-2025.09] [[query-plan-lock-nodes]] === Lock Nodes -The `LockNodes` operator is sometimes used in conjunction with xref:planning-and-tuning/operators/operators-detail.adoc#query-plan-locking-merge[`LockingMerge`] operator to lock nodes. +The `LockNodes` operator is sometimes used in conjunction with the xref:planning-and-tuning/operators/operators-detail.adoc#query-plan-locking-merge[`LockingMerge`] operator to lock nodes. .LockingMerge @@ -6079,8 +6080,6 @@ MERGE (s)-[:FRIENDS_WITH]->(t:Person {size: size([()-->()|1])}) .Query Plan [role="queryplan", subs="attributes+"] ---- -Cypher 5 - Planner COST Runtime PIPELINED From 39ed926abef3a15f3ef093b08d4c61375f2613d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20Pryce-=C3=85klundh?= <112686610+JPryce-Aklundh@users.noreply.github.com> Date: Wed, 3 Sep 2025 10:05:04 +0200 Subject: [PATCH 3/3] fix example header --- .../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 c9ed22ea6..a656bb82d 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 @@ Total database accesses: 15, total allocated memory: 2232 The `LockNodes` operator is sometimes used in conjunction with the xref:planning-and-tuning/operators/operators-detail.adoc#query-plan-locking-merge[`LockingMerge`] operator to lock nodes. -.LockingMerge +.LockNodes ====== .Query