Skip to content

Commit 76754bf

Browse files
Add documentation for MergeInto (#1422)
Co-authored-by: Stefano Ottolenghi <[email protected]>
1 parent 569e38f commit 76754bf

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
@@ -6035,6 +6035,57 @@ Total database accesses: 4, total allocated memory: 184
60356035
60366036
======
60376037

6038+
[query-plan-merge-into]]
6039+
=== Merge Into
6040+
6041+
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.
6042+
6043+
If necessary, the operator locks the pattern nodes before creating the relationship, to avoid creating multiple relationships between the nodes.
6044+
6045+
6046+
.MergeInto
6047+
======
6048+
6049+
.Query
6050+
[source, cypher]
6051+
----
6052+
PROFILE
6053+
MATCH (s:Person {name: 'me'})
6054+
MERGE (s)-[:FRIENDS_WITH]->(s)
6055+
----
6056+
6057+
.Query Plan
6058+
[role="queryplan", subs="attributes+"]
6059+
----
6060+
Planner COST
6061+
6062+
Runtime PIPELINED
6063+
6064+
Runtime version {neo4j-version}
6065+
6066+
Batch size 128
6067+
6068+
+-----------------+----+-------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+----------------------+
6069+
| Operator | Id | Details | Estimated Rows | Rows | DB Hits | Memory (Bytes) | Page Cache Hits/Misses | Time (ms) | Pipeline | Indexes Used |
6070+
+-----------------+----+-------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+----------------------+
6071+
| +ProduceResults | 0 | | 1 | 0 | 0 | 0 | | | | |
6072+
| | +----+-------------------------------------------------------+----------------+------+---------+----------------+ | | +----------------------+
6073+
| +EmptyResult | 1 | | 1 | 0 | 0 | | | | | |
6074+
| | +----+-------------------------------------------------------+----------------+------+---------+----------------+ | | +----------------------+
6075+
| +Apply | 2 | | 1 | 1 | 0 | | | | | |
6076+
| |\ +----+-------------------------------------------------------+----------------+------+---------+----------------+ | | +----------------------+
6077+
| | +MergeInto | 3 | MERGE (s)-[anon_0:FRIENDS_WITH]->(s) | 1 | 1 | 1 | | | | | |
6078+
| | | +----+-------------------------------------------------------+----------------+------+---------+----------------+ | | +----------------------+
6079+
| | +Argument | 4 | s | 1 | 1 | 0 | 2288 | 1/0 | 0.673 | Fused in Pipeline 1 | |
6080+
| | +----+-------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+----------------------+
6081+
| +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 |
6082+
+-----------------+----+-------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+----------------------+
6083+
6084+
Total database accesses: 15, total allocated memory: 2232
6085+
----
6086+
6087+
======
6088+
60386089

60396090
[[query-plan-locking-merge]]
60406091
=== Locking Merge

0 commit comments

Comments
 (0)