【问题标题】:Gremlin Query to count Edges - MemoryLimitExceededException AWS NeptuneGremlin 查询以计算边数 - MemoryLimitExceededException AWS Neptune
【发布时间】:2021-06-05 22:13:03
【问题描述】:

Gremlin 查询 Neptune 以计算具有特定标签的顶点的边数,结果为 MemoryLimitExceededException。错误只发生几次,即如果我运行查询 10 次,则成功两次。

海王星正在使用db.r5.xlarge

查询

g.V().hasLabel('MyVertex').has('myLabel',1234).outE().hasLabel('MY_EDGE_LABEL').count().next()

标签为MyVertex 的顶点超过300 万个,边缘标签为MY_EDGE_LABEL 的边数超过100 万。

错误:

{
    "code": "MemoryLimitExceededException",
    "requestId": "123456-abcd-1234-1234-11aa221122ab",
    "detailedMessage": "Query cannot be completed due to memory limitations."
}

我的问题:

  • Neptune 上的查询是否有任何设置(例如内存限制)可以提高?
  • 查询中是否有任何内容可以调整以获得相同的结果但消耗更少的内存。

【问题讨论】:

    标签: amazon-web-services gremlin tinkerpop amazon-neptune


    【解决方案1】:

    添加一个limit(1)来限制结果的大小已经解决了这个问题。

    g.V().hasLabel('MyVertex').has('myLabel',1234).outE().hasLabel('MY_EDGE_LABEL').count().limit(1).next()

    【讨论】: