incubator-hugegraph icon indicating copy to clipboard operation
incubator-hugegraph copied to clipboard

请问有没有提供批量删除顶点的api

Open luobairan opened this issue 7 years ago • 5 comments

Expected behavior 期望表现

{type something here...}

Actual behavior 实际表现

{type something here...}

Steps to reproduce the problem 复现步骤

  1. {step 1}
  2. {step 2}
  3. {step 3}

Status of loaded data 数据状态

Vertex/Edge summary 数据量

  • loaded vertices amount: {like 10 million}
  • loaded edges amount: {like 20 million}
  • loaded time: {like 200s}

Vertex/Edge example 数据示例

{type something here...}

Schema(VertexLabel, EdgeLabel, IndexLabel) 元数据结构

{type something here...}

Specifications of environment 环境信息

  • hugegraph version: {like v0.7.4}
  • operating system: {like centos 7.4, 32 CPUs, 64G RAM}
  • hugegraph backend: {like cassandra 3.10, cluster with 20 nodes, 3 x 1TB HDD disk each node}

luobairan avatar Nov 06 '18 09:11 luobairan

多谢反馈,目前没有批量删除顶点的API,后续我们会考虑加入这个特性。你希望使用这个API是出于性能的考虑还是业务场景中有类似的需求呢?

Linary avatar Nov 13 '18 02:11 Linary

@luobairan 如果删除量不是太大的话(一次删除少于1000条记录),可以使用Gremlin Drop语句

javeme avatar Nov 13 '18 03:11 javeme

同需求,几亿数据删好几天

FANGOD avatar Mar 02 '21 02:03 FANGOD

新的 0.11-b3 补丁包 可以大幅度提升删除速度,并且如果是用REST API,建议通过同时提供 label+id 两个参数的方式删除。

gremlin的删除示例:

count = 0
def all = hugegraph.traversal().V().hasLabel("xxx").limit(10000)
while(all.hasNext()) {
    while(all.hasNext()) {
      all.next().remove()
      if (++count >= 500) {
        g.tx().commit()
        count = 0
      }
    }
    g.tx().commit()
    all = hugegraph.traversal().V().has("xxx").limit(10000)
}
!all.hasNext()

也可进一步参考:https://github.com/hugegraph/hugegraph/issues/1298

Linary avatar May 31 '21 11:05 Linary

利用REST API删除顶点/边时,建议通过同时提供 label+id 两个参数的方式删除,形如:delete /path/to/{id}?label=xx

javeme avatar Nov 12 '21 15:11 javeme