neo4j删除所有数据
一次性删除
sql
MATCH (n)
DETACH DELETE n ;
分批次删除
- 先删除关系
cypher
MATCH ()-[r]->()
WITH r LIMIT 100000
DELETE r
RETURN count(r)
- 在删除节点
sql
MATCH (n)
WITH n LIMIT 100000
DELETE n
RETURN count(n)
验证
- 查询节点总数
sql
MATCH (n)
RETURN count(n) AS nodeCount;
- 查询关系总数
sql
MATCH ()-[r]->()
RETURN count(r) AS relationshipCount;