cypher - Neo4j delete all the nodes in a label and their relationships -
i know question has been asked many times answers didn't solve problem. want delete nodes in label telephonenumber , relationships (millions). have tried first deleting relationships way:
match (:person)-[r:has_telephone_number]->(:telephonenumber) delete r
but after amount of time error gc overhead limit exceeded
. have tried limiting query this:
match (:person)-[r:has_telephone_number]->(:telephonenumber) r limit 100 delete r
but same error. have tried way:
match (t:telephonenumber) optional match (t)-[r]-() delete t,r
but same error again. how can delete nodes in label , relationships without exceeding garbage collector overhead limit?
you may want take advantage of apoc procedures apoc.periodic.commit(). also, since you're wanting delete nodes, detach delete help, delete relationships node , delete node itself.
an example of usage might be:
call apoc.periodic.commit(" match (tel:telephonenumber) tel limit {limit} detach delete tel return count(*) ",{limit:10000})
you can adjust batch size limit necessary, 10000 works.
Comments
Post a Comment