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

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

问题描述

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

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

开始 n = 节点(*)匹配 n-[r?]-()其中 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 谷歌群组]

[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天全站免登陆