Anastasia
Anastasia

Reputation: 874

neo4j Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

I loaded a large graph of approx 600 million nodes and around 1 billion relationships using batch insert. I am now trying to run a query on a very small subset of a graph and I am getting Java heap space error. I know that I can set Java heap size in neo4j-wrapper.conf but I am still getting an error. Is there any other place where I might have set max heap size? Also, I am not sure why it is running out of memory. My query is:

MATCH (start:Label1)-[r]->(end:Label2) WHERE start.name='Name1' RETURN end.Name2

I know that the result set has less than 1000 nodes and I am limiting the search space (or maybe I am not)?

Upvotes: 0

Views: 692

Answers (1)

michael-john-fu
michael-john-fu

Reputation: 66

Try this:

MATCH (start:Label1)
WHERE start.name = 'Name1'
WITH start
MATCH (start)-[r]->(end:Label2)
RETURN end.name2

Also add the type of the relationship, if there is one.

You can try changing the memory maps of the cache as well, if this doesn't help:

http://neo4j.com/docs/stable/configuration-io-examples.html

Upvotes: 1

Related Questions