cancel
Showing results for 
Search instead for 
Did you mean: 

Creating relationships in a not so big graph takes very long time

sr01
Node

I have this query :

with [
{from:"53e997ccb7602d9701fbefd8", to:"53e9987db7602d97020b9083"}, {from:"53e997ccb7602d9701fbefd8",to:"53e99998b7602d97021dea70"},
{from:"53e997ccb7602d9701fbefec", to:"53e999e7b7602d970222ac55"}
, // 120 entries in total
] as tab
unwind tab as t
MATCH (n {id:t.from}) MATCH (m {id:t.to})
MERGE (n)-[:CITES]->(m)
I have 200k nodes in my graph.
Executing this query takes 31s.
In average, every relationship takes 0.25s to be created, so I have a troughput of 345k/day. Unfortunately I have 10M relationships to create... any idea how to make this happen in less than a month ?
1 REPLY 1

glilienfield
Ninja
Ninja

Because your match clause don’t have a label, you will scan every node. Can you include a node label in these? If so, you can add index for that label and the ‘id’ property. That nat speed things up.