Neo4J data Size issue: `apoc.load.jdbc` : Caused by: java.sql.SQLException: Java heap space #1406*


When i was fetching the data after connecting the MySQL database i got the below mentioned error.


** Failed to invoke procedure apoc.load.jdbc : Caused by: java.sql.SQLException: Java heap space #1406**

Please help on the issue.


Hello Sai,

Thank you for opening a new question for your issue.

Neo4j uses RAM.

...and a lot of it. That's one of the reasons the execution plans and query profiling are built-into Cypher and the browser. Every node and relationship that is a possible match in a MATCH statement has to be loaded into ram.

EXPLAIN [MATCH...] will show the execution plan, and give you an idea of how many nodes will need to be in ram at any given step in execution of the query.

PROFILE [MATCH...] will run it, and show acutal usage.

Show us your graph and query, and describe your efforts and goal.

The community can probably help design a better graph for more efficient queries, or adjust your query to get your desired results. To do that, we need more information about your graph, and the query you're trying to run.

OR: give it more RAM and better memory configuration

As I mentioned in the other thread:

Neo4j or your JVM need a better memory configuration. Most likely $NEO4J_HOME/conf/neo4j.conf has incorrectly sized limit, cache, or heap. Try removing any such configurations from that file, and let Neo4j use the defaults. More information is available here: Neo4j Performance Tuning.

Of additional note is proper heap sizing.

More specifically, check the configuration file for these two settings:

  • dbms.memory.heap.initial_size
  • dbms.memory.heap.max_size

These should both be the same value, for example 8G to limit memory usage to 8GB of ram.

Last but not least, are adjustments you can make the the JVM for better recover on an out of memory error..