Skip to content

Commit 523e35a

Browse files
Add documentation for MergeInto (#1422)
Co-authored-by: Stefano Ottolenghi <[email protected]>
1 parent c01e13d commit 523e35a

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

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

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6005,6 +6005,57 @@ Total database accesses: 4, total allocated memory: 184
60056005
60066006
======
60076007

6008+
[query-plan-merge-into]]
6009+
=== Merge Into
6010+
6011+
The `MergeInto` operator is similar to the xref:planning-and-tuning/operators/operators-detail.adoc#query-plan-merge[`Merge`] operator, but is used when the start and end node of the pattern is matched outside the `MERGE` pattern.
6012+
6013+
If necessary, the operator locks the pattern nodes before creating the relationship, to avoid creating multiple relationships between the nodes.
6014+
6015+
6016+
.MergeInto
6017+
======
6018+
6019+
.Query
6020+
[source, cypher]
6021+
----
6022+
PROFILE
6023+
MATCH (s:Person {name: 'me'})
6024+
MERGE (s)-[:FRIENDS_WITH]->(s)
6025+
----
6026+
6027+
.Query Plan
6028+
[role="queryplan", subs="attributes+"]
6029+
----
6030+
Planner COST
6031+
6032+
Runtime PIPELINED
6033+
6034+
Runtime version {neo4j-version}
6035+
6036+
Batch size 128
6037+
6038+
+-----------------+----+-------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+----------------------+
6039+
| Operator | Id | Details | Estimated Rows | Rows | DB Hits | Memory (Bytes) | Page Cache Hits/Misses | Time (ms) | Pipeline | Indexes Used |
6040+
+-----------------+----+-------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+----------------------+
6041+
| +ProduceResults | 0 | | 1 | 0 | 0 | 0 | | | | |
6042+
| | +----+-------------------------------------------------------+----------------+------+---------+----------------+ | | +----------------------+
6043+
| +EmptyResult | 1 | | 1 | 0 | 0 | | | | | |
6044+
| | +----+-------------------------------------------------------+----------------+------+---------+----------------+ | | +----------------------+
6045+
| +Apply | 2 | | 1 | 1 | 0 | | | | | |
6046+
| |\ +----+-------------------------------------------------------+----------------+------+---------+----------------+ | | +----------------------+
6047+
| | +MergeInto | 3 | MERGE (s)-[anon_0:FRIENDS_WITH]->(s) | 1 | 1 | 1 | | | | | |
6048+
| | | +----+-------------------------------------------------------+----------------+------+---------+----------------+ | | +----------------------+
6049+
| | +Argument | 4 | s | 1 | 1 | 0 | 2288 | 1/0 | 0.673 | Fused in Pipeline 1 | |
6050+
| | +----+-------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+----------------------+
6051+
| +NodeIndexSeek | 5 | RANGE INDEX s:Person(name) WHERE name = $autostring_0 | 1 | 1 | 2 | 376 | 1/0 | 0.256 | In Pipeline 0 | range_person_name: 1 |
6052+
+-----------------+----+-------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+----------------------+
6053+
6054+
Total database accesses: 15, total allocated memory: 2232
6055+
----
6056+
6057+
======
6058+
60086059

60096060
[[query-plan-locking-merge]]
60106061
=== Locking Merge

0 commit comments

Comments
 (0)