I am trying to create an R-TREE of 5834580 of nodes.
I found in this question a similair problem and i tried it's solution, so this is my code :
call apoc.periodic.commit("MATCH (pl:pickup_location) WITH collect(pl) AS pickup CALL spatial.addNodes('nyc',pickup) YIELD count RETURN count",{limit:1000})
however, since yesterday the computer didn't finish loading the result.
today, i tried the second answer with iterate :
CALL apoc.periodic.iterate(
"MATCH (pl:pickup_location) RETURN pl",
"CALL spatial.addNode('nyc', pl) YIELD node RETURN node",
{batchSize:10000, parallel:false, listIterate:true})
and i get this error :
Neo.ClientError.Procedure.ProcedureCallFailed: Failed to invoke procedure `apoc.periodic.iterate`: Caused by: java.lang.OutOfMemoryError: Java heap space
what is wrong ? what should i do ?
Your problem with the
apoc.periodic.commitis that your query will always return the same nodes with yourMATCH (pl:pickup_location). There is no condition to find only nodes that are not in the spatial layout.I don't remember the model of the spatial plugin, but from what I remember, on your
pickup_locationnodes, you should have a specific relation to the R-Tree.So you should transform your auery to something like that :
For the problem on the
apoc.periodic.iterateis just a memory problem, you don't have enought RAM to execute transactions.You have two solutions :
neo4j.conffile)10000is a little big, change it to1000