使用cypher删除neo4j中的所有节点和关系超过了堆空间 [英] Deleting all nodes and relationships in neo4j using cypher exceeds heap space

查看:210
本文介绍了使用cypher删除neo4j中的所有节点和关系超过了堆空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试按照neo4j google组和其他在线来源中的建议运行此查询:

I have been trying to run this query as recommended in the neo4j google group and in other sources online:

开始n =节点(*) 匹配n- [r?]-() WHERE ID(n)> 0 删除n,r;

START n = node(*) MATCH n-[r?]-() WHERE ID(n)>0 DELETE n, r;

为了删除所有节点和测试之间的关系.从控制台执行此操作时,我的Java堆空间用完了.当我从python(使用新出现的graph_db.clear(),使用相同的查询显示)执行此操作时,我收到一个"SystemError:None",我认为这是相同的Java堆空间错误.我有一个具有500k节点,仅5k关系和7M属性的数据库.我正在使用neo4j-1.8.1在具有8GB RAM的Mac笔记本电脑(10.6.8)上运行.我猜我对删除节点(基本上没有任何关系,所以子图非常小)会超出Java堆空间感到有些惊讶,但是我对neo4j的工作原理很幼稚.任何关于如何前进的建议都将受到赞赏.我确实知道数据目录中的rm -rf并可以从头开始工作,但是我认为可能没有那么激烈的解决方案.

in order to delete all nodes and relationships between tests. When I do so from the console, I run out of java heap space. When I do so from python (using the newish graph_db.clear(), which appears uses the same query), I get a "SystemError: None" which, I assume, is the same java heap space error. I have a database with 500k nodes, only 5k relationships, and 7M properties. I am running on a Mac laptop (10.6.8) with 8GB RAM using neo4j-1.8.1. I guess I am a bit surprised that deleting nodes (with essentially no relationships, so very small subgraphs) would exceed the java heap space, but I am pretty naive about how neo4j works. Any suggestions in how to go forward are appreciated. I do know that rm -rf in the data directory and starting from scratch will work, but I thought there might be a less-drastic solution.

[交叉发布到neo4j Google网上论坛]

[cross-posted to neo4j google groups]

推荐答案

从Neo4j 2.3.3开始,引入了一种删除节点和关系的新方法.参见 2.3.3文档.

As of Neo4j 2.3.3, a new way of removing node and relationship had been introduced. See 2.3.3 Docs.

例如,您可以这样做:

MATCH(n) DETACH DELETE n;

这篇关于使用cypher删除neo4j中的所有节点和关系超过了堆空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆