Neptune 性能

0

【以下的问题经过翻译处理】 我们的图形数据库使用 Neo4j AuraDB,但在数据上传方面存在问题。因此,我们决定使用迁移工具迁移到 AWS Neptune。

我们的数据库中有 370 万个节点和 1120 万个关系。数据库实例为 db.r5.large,有 2 个 CPU 和 16GiB 内存。

同样的 AWS Neptune OpenCypher 查询比 AuraDB Cypher 查询要慢很多(大约慢 7-10 倍)。此外,我们还尝试用 Gremlin 重写查询并测试性能,但速度仍然很慢。我们在 AuraDB 上有节点和查找索引,但无法在 AWS Neptune 上创建,因为它会自动处理这些索引。

有什么办法可以提高 AWS Neptune 的性能?

1 réponse
0

【以下的回答经过翻译处理】 目前,openCypher 支持只是预览版,还没有达到 GA 级别。最新的引擎版本确实有一些重大改进,但还有更多改进有待交付。

至于 Gremlin 查询,将 Cypher 转换为 Gremlin 的工具往往会构建相当复杂的查询。我认为与 Cypher 查询相对应的 Gremlin 查询应该是这样的。

g.V().has('Member','address', address).as('m').
      out('HAS').hasLabel('Token').as('t').
      in('HAS').hasLabel('Member').as('om').
      where(neq('m')).
      group().
        by('om').
        by(select('t').count()).
      order(local).
        by(values,desc).
      limit(20) 

如果你想要所有的属性,只需要添加一个valueMap代码块,就像这样:

g.V().has('Member','address', address).as('m').
      out('HAS').hasLabel('Token').as('t').
      in('HAS').hasLabel('Member').as('om').
      where(neq('m')).
      group().
        by(select('om').valueMap(true)).
        by(select('t').count()).
      order(local).
        by(values,desc).
      limit(20)
profile picture
EXPERT
répondu il y a 8 mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions

Contenus pertinents