如何删除亚马逊 Neptune 中的图表

How to delete graph in amazon Neptune

如何删除海王星图或删除图中的所有顶点和边。

gremlin还有办法吗。而不是迭代所有节点并删除单个顶点

Gremlin 代码将是 g.V().limit(100000).drop().iterate();

更新: g.V().drop().iterate() 就足够了,因为删除所有查询现在已经在 Neptune 中进行了优化。

g.V().drop().iterate() 应该够了。如果要删除 ALL 个顶点和边,则不需要分批执行或迭代固定数量的顶点。

g.V().drop().iterate(); 是的,批处理不是必需的,但是您已经对 Neptune 图数据库进行了迭代

当谓词数量增加时,AWS Neptune 顶点删除的成本很高。

什么是谓词?

https://docs.aws.amazon.com/neptune/latest/userguide/feature-overview-data-model.html

使用 AWS Neptune 的 Explain api 了解图形数据库中的谓词数量。如果谓词数量很多,它还会显示警告。

参考这个 python 脚本来删除没有超时错误和更快的删除顶点的方法。

https://github.com/awslabs/amazon-neptune-tools/blob/master/drop-graph/drop-graph.py

添加另一个答案,因为 Amazon Neptune 现在有一个 API 无需使用 Gremlin 即可有效删除整个图表。详见[1]。

[1] https://docs.aws.amazon.com/neptune/latest/userguide/manage-console-fast-reset.html

重置可以通过 curl 命令或从 Neptune (Jupyter) 笔记本完成。