【问题标题】:is OrientDB using the index in gremlin-java?OrientDB 是使用 gremlin-java 中的索引吗?
【发布时间】:2015-11-15 00:38:42
【问题描述】:

我正在创建一个非常简单的图形数据库结构来评估 OrientDB (2.1.5) 的性能,我看到的性能非常糟糕,我一定是做错了。 com.tinkerpop.blueprints.impls.orient.OrientGraph (2.6.0) 上的以下内容:

g.createKeyIndex("typehint", Vertex.class)
g.createKeyIndex("fqn", Vertex.class)

// add a bunch of Vertices with "typehint" and "fqn" values

// then issue queries for vertices with a composite key
// (btw, I don't know how to enforce this as a composite key)
g.query().has("typehint", ...).has("fqn", ...)

但这太慢了!

OrientDB 是否无法处理has 调用的链接?解决方法是什么?

【问题讨论】:

    标签: java orientdb gremlin


    【解决方案1】:

    您在创建顶点时是否使用了 V 的子类?如果是,请查看有关创建索引的正确方法的文档:http://orientdb.com/docs/last/Graph-Database-Tinkerpop.html#using-indices。然后,调用

    g.query().labels("MyClass").has("typehint", ...)
    

    【讨论】:

    • 啊,谢谢我不知道labels。我的问题是阅读 gremlin 文档(这很糟糕)。昨晚我还发现了这些文档,并了解了如何添加 class: 标签和简单的复合键。它实际上是您指向我的文档,因此我将其标记为答案并添加更多详细信息。
    • 嗯,我的 query() 对象上似乎没有 labels。您使用的是更新的 API 吗?
    • OrientBaseGraph 上有一个名为getVerticesOfClass 的方法,这似乎与您的labels 所说的一样。也许labels 特定于您的数据库实现?
    • 是的,您应该将 .query() 转换为 OrientGraphQuery 类。示例Iterable<Vertex> rcs = ((OrientGraphQuery) db.query()).labels("rawCategory").vertices();
    • 我想我宁愿使用getVerticesOfClass 方法。
    猜你喜欢
    • 2016-05-28
    • 1970-01-01
    • 2016-08-04
    • 1970-01-01
    • 2020-07-18
    • 1970-01-01
    • 1970-01-01
    • 2020-02-06
    • 1970-01-01
    相关资源
    最近更新 更多