How do I determine the number of nodes and relationships to be effected by a detach delete
Prior to running a match …. detach delete n;
which will find said nodes and delete all relationships associated with said nodes as well as delete the nodes themselves one might want to run a query to determine how many nodes/relationships will be effected.
For example, using the :play movies
database as part of the Neo4j Browser, if one runs
match (n:Person) return count(n), sum ( size( (n)-[]->()));
this will report back
which would indicate that if you are to then run match (n:Person) detach delete n;
this will effect
133 nodes and 253 relationships and as depicted
In this case the 133 nodes and 253 relationships is not a significantly large number.
However, if the query was to return tens of thousands of nodes and relationships to be effected one should reconsider the approach and follow the document entitled Large Delete Transaction Best Practices in Neo4j
Was this page helpful?