Using neo4j 5.20.0 on Ubuntu, and just the cypher-shell
In my EXPLAIN/PROFILE
on a LOAD CSV
query, I am seeing an Eager operation with the details
read/set conflict for relationship type: PORTRAYS (Operator: 4 vs 11)
First off, the single google result for "read/set conflict neo4j" points to Operators in detail in which it only appears in the output of example commands, but never explained. I can deduce what it means: that a node or relationship is simultaneously trying to be read and written for different rows, and if done lazily then you could end up with trouble; thus the query eagerly loads all the incoming data. However, I have no idea how to interpret "Operator: 4 vs 11" or if it's even useful information.
I have resolved a number of these in my load queries by simply separating them into two queries, so each one executes a single MERGE
instead of two MERGE
s in the same query. However, in this final example there is no way for me to split them up. I am looking for a relationship A-->B, then for a relationship B-->C, then extending it transitively to A-->C with the same properties. The end state is two relationships, so apoc.refactor.to
(which moves a relationship) is not what I'm looking for.
This is what I am using (adapted to the movie scenario):
LOAD CSV WITH HEADERS FROM 'file:///input.csv' AS row
WITH row
MATCH (p:Person {personID: row.personID})-[:AKA]->(a:Alias)
MATCH (c:Character {characterID: row.characterID})<-[r1:PORTRAYS]-(a)
MERGE (p)-[r2:PORTRAYS]->(c)
SET r2 = properties(r1)
For example, you know that "Ludacris" (alias) portrays "Tej Parker" (character) in the Fast & Furious movies. You also know that Ludacris's real name is Christopher Bridges (person). Thus, (Christopher Bridges)-[:PORTRAYS]->(Tej Parker)
with the exact same relationship properties as (Ludacris)-[:PORTRAYS]->(Tej Parker)
.
How can I remove this eager operation? Or in other words, how can I clone a relationship?