Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
07-06-2021 07:44 AM
Hello,
I have two labels (commits and users).
In the commits I have the ID of the committer as Int (committer-id).
I want to create a simple relationship between the committer and the user (u.id).
My solution looks like this:
match(c:commits)
with c
match(u:users)
where c.committer_id = u.id
create(c)-[:committer]->(u)
My current problem is that is takes a long time to create this relationship.
I added an index the committer_id, but it didn't improve my query.
Any Idea of improvements?
Constraints:
Settings:
dbms.memory.heap.initial_size=8G
dbms.memory.heap.max_size=8G
dbms.memory.pagecache.size=5G
Solved! Go to Solution.
07-06-2021 07:51 AM
Hello @JuSte94 and welcome to the Neo4j community
You should try with the apoc.periodic.iterate() function in the APOC plugin:
CALL apoc.periodic.iterate(
"MATCH (u:users) MATCH (c:commits) WHERE c.committer_id = u.id RETURN c, u",
"CREATE (c)-[:committer]->(u)",
{batchSize: 10000}
)
Regards,
Cobra
07-06-2021 07:51 AM
Hello @JuSte94 and welcome to the Neo4j community
You should try with the apoc.periodic.iterate() function in the APOC plugin:
CALL apoc.periodic.iterate(
"MATCH (u:users) MATCH (c:commits) WHERE c.committer_id = u.id RETURN c, u",
"CREATE (c)-[:committer]->(u)",
{batchSize: 10000}
)
Regards,
Cobra
All the sessions of the conference are now available online