Thank you for your reply!
We would split the statement if we could, but we are using Neo4j streams and we noticed a massive degrade in throughput when we used apoc.cypher.runMany. It is up to 10x slower than a plain Cypher query.
That being said, I have some trouble getting your query to work within UNWIND.
Running
UNWIND $events as event
MATCH (p:Person {id: event.id})-[r:LIKES]->(s)
DELETE (r)
UNION
FOREACH (song IN event.songdata |
CREATE (p)-[:LIKES]->(s:Song {title: k.title}))
yields an error because event is unknown in the clause following the union. I just can't get it to work.
If you know of another possibility to split the statements, we would be glad to hear it.
Unfortunatly we haven't figured out yet the exact reason why apoc.cypher.runMany is so slow.
Do you use a driver to send queries to your database?
UNWIND $events as event
MATCH (p:Person {id: event.id})-[r:LIKES]->(s)
DELETE (r)
UNION
UNWIND $events as event
FOREACH (song IN event.songdata |
CREATE (p)-[:LIKES]->(s:Song {title: k.title}))