Skip to content

Commit abc107c

Browse files
committed
Add documentation for MergeInto
1 parent c01e13d commit abc107c

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

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

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6005,6 +6005,58 @@ 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 will lock the pattern nodes before creating the relationship, to make sure we don't create multiple relationships between the nodes.
6014+
6015+
6016+
.MergeInto
6017+
======
6018+
6019+
6020+
.Query
6021+
[source, cypher]
6022+
----
6023+
PROFILE
6024+
MATCH (s:Person {name: 'me'})
6025+
MERGE (s)-[:FRIENDS_WITH]->(s)
6026+
----
6027+
6028+
.Query Plan
6029+
[role="queryplan", subs="attributes+"]
6030+
----
6031+
Planner COST
6032+
6033+
Runtime PIPELINED
6034+
6035+
Runtime version {neo4j-version}
6036+
6037+
Batch size 128
6038+
6039+
+-----------------+----+-------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+----------------------+
6040+
| Operator | Id | Details | Estimated Rows | Rows | DB Hits | Memory (Bytes) | Page Cache Hits/Misses | Time (ms) | Pipeline | Indexes Used |
6041+
+-----------------+----+-------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+----------------------+
6042+
| +ProduceResults | 0 | | 1 | 0 | 0 | 0 | | | | |
6043+
| | +----+-------------------------------------------------------+----------------+------+---------+----------------+ | | +----------------------+
6044+
| +EmptyResult | 1 | | 1 | 0 | 0 | | | | | |
6045+
| | +----+-------------------------------------------------------+----------------+------+---------+----------------+ | | +----------------------+
6046+
| +Apply | 2 | | 1 | 1 | 0 | | | | | |
6047+
| |\ +----+-------------------------------------------------------+----------------+------+---------+----------------+ | | +----------------------+
6048+
| | +MergeInto | 3 | MERGE (s)-[anon_0:FRIENDS_WITH]->(s) | 1 | 1 | 1 | | | | | |
6049+
| | | +----+-------------------------------------------------------+----------------+------+---------+----------------+ | | +----------------------+
6050+
| | +Argument | 4 | s | 1 | 1 | 0 | 2288 | 1/0 | 0.673 | Fused in Pipeline 1 | |
6051+
| | +----+-------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+----------------------+
6052+
| +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 |
6053+
+-----------------+----+-------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+----------------------+
6054+
6055+
Total database accesses: 15, total allocated memory: 2232
6056+
----
6057+
6058+
======
6059+
60086060

60096061
[[query-plan-locking-merge]]
60106062
=== Locking Merge

0 commit comments

Comments
 (0)