Delete all nodes and relationships in neo4j 1.8

后端 未结 7 2017
孤独总比滥情好
孤独总比滥情好 2021-01-30 05:10

I know this question is asked by many people already
for my research, here\'s some questions asked before

  1. How to delete all relationships in neo4j graph?
7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-30 05:38

    for a big database you should either remove the database from the disk (after you stop the engine first I guess) or use in Cypher something like:

    MATCH (n)
    OPTIONAL MATCH (n)-[r]-()
    WITH n,r LIMIT 50000
    DELETE n,r
    RETURN count(n) as deletedNodesCount
    

    see https://zoomicon.wordpress.com/2015/04/18/howto-delete-all-nodes-and-relationships-from-neo4j-graph-database/ for some more info I've gathered on this from various answers

提交回复
热议问题