Hi everyone
I am migrating my data from mongo to my neo4j server. In my data, I have users with unique id's and the id's of their following/follower users.
I iterate through the users from mongo and first merge them into neo4j: (please don't mind curly brackets and quote marks, those work with my python driver)
MERGE (a: Author {{user_id: {user_id}}})
Then I merge all the followers and followings:
UNWIND {linked_people} AS friend_id
MERGE (a: Author {{user_id: friend_id}})
Finally I merge the relationships:
UNWIND {edges} AS edge
MATCH (a:Author), (b:Author)
WHERE a.user_id = edge[0] AND b.user_id = edge[-1]
MERGE (a)-[r:FOLLOWS]->(b)
The migration process becomes slower and slower over the time. I have gone through 5.4 million users and there are 1.4 million to go. I am afraid, the last half a million or so will be very painful to wait.
Probably, some nodes accumulate more and more followers, thus when I try to add more relationships on them, merging takes a longer time.
A similar issue had been pointed out here: Slowdown while merging 200k relationships however the answer from @anthapu was from February '20.
I wonder, if there has been an optimization regarding that problem over the last two years. Or do I have to live with that?
Neo4j:
"Neo4j Kernel" "4.4.5" "enterprise"
Constraints:
Indices:
Regards
Ahmet