cypher - ConstraintViolationTransactionFailureException when deleting all nodes from Neo4j -
when attempting delete nodes neo4j graph database, have done many times in past on smaller datasets, consistently ran across error: undefined - undefined
after running query
match (n) detach delete n
i figured number of nodes attempting delete @ once may large (>100000), tried query
match (n) optional match (n)-[r]-() n,r limit 10000 delete n,r
and many variations of it, acting on read in post: best way delete nodes , relationships in cypher. returned error
org.neo4j.kernel.api.exceptions.constraintviolationtransactionfailureexception: cannot delete node<32769>, because still has relationships. delete node, must first delete relationships.
and each time, node neo4j not delete differs. there way of resolving issue?
perhaps noteworthy, while desperately running variations of previous query, when ran query
match ()-[r]-() optional match (n)-[r]-() r,n limit 10000 delete r,n
i got rather unique error
java heap space
in console, showed neo.databaseerror.general.unknownerror
in banner.
one of problems way queries written each delete
attempting delete single node/relationship pair @ time. if nodes have more 1 relationship, constraint violation error, since in order delete node have delete of relationships (either beforehand or @ same time).
to delete 10000 nodes (and relationships), use query:
match (n) n limit 10000 detach delete n;
Comments
Post a Comment