cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! Site migration is underway. Phase 2: migrate recent content

Java Heap space issue while creating relationship between nodes

neo4j version - 4.3.6
desktop version - 1.4.9
browser version - 4.4.0

cypher query
//relationship- funclocation + Equipment
MATCH
  (f:funclocation),
  (e:equipmentno)
WHERE f.equipmenttag_d= e.equipmenttag_d
MERGE (f)-[r:HAS_EQUIPMENT]->(e);
//RETURN f.equipmenttag_d, e.equipmenttag_d limit 5;

Error details : Java heap space
Any suggestion please

1 ACCEPTED SOLUTION

Many thanks Koji, this worked

View solution in original post

2 REPLIES 2

koji
Ninja
Ninja

Hi @quamar.rashid

I think the number of noes is very large and one of the following will solve your problem.

1: Increase the heap size.

<NEO4J_HOME>/conf/neo4j.conf
# Java Heap Size: by default the Java heap size is dynamically calculated based
# on available system resources. Uncomment these lines to set specific initial
# and maximum heap size.
dbms.memory.heap.initial_size=512m
dbms.memory.heap.max_size=1G

You can change the heap size like this.

dbms.memory.heap.initial_size=2G
dbms.memory.heap.max_size=2G

2: Use apoc.periodic.iterate
You need to install APOC plugin.

CALL apoc.periodic.iterate(
  "MATCH (f:funclocation),(e:equipmentno) WHERE f.equipmenttag_d = e.equipmenttag_d RETURN f,e",
  "MERGE (f)-[:HAS_EQUIPMENT]->(e)",
  {batchSize:1000, parallel:false})

Many thanks Koji, this worked