我目前使用的是带有默认TinkerGraph-Gremlin(在内存中运行)的gremlin python client的修补程序。我想提高查询的性能,并阅读createIndex()
函数,这听起来是我的用例的完美之选,遗憾的是我无法用python客户机创建索引。我还尝试将这些行添加到启动的groovy脚本中(在groovy scirpt中运行,没有错误),但是当我运行性能基准测试时,我得到了相同的结果。在
所以我的问题是:我能用python客户机创建一个索引吗?如果不能,有什么解决办法?还有没有一种方法可以询问gremlin是否定义了任何索引?在
注:对于groovy脚本,我使用了默认的empty-sample.grooy
,并在最后一次调用之前添加以下行:
graph.createIndex("name", Vertex.class)
graph.createIndex("nap", Edge.class)
谢谢!在
使用gremlinpython v3.2.6
搜索TinkerPop的github,我发现你可以直接发送请求,因为它是使用客户机对象的数据库控制台。这种行为在the GitHub of Tinkerpop中有解释。我将展示同步版本,在GitHub中还有一个异步版本:
要查看必须发送的命令,请查看您正在使用的确切数据库,对于Janusgraph,请参见its indexing documentation。在
python客户端没有
createIndex()
方法,因为TinkerPop在3.x中没有对索引提供任何抽象。我们依赖于底层图形数据库的索引和模式创建方法。你必须降低到API级别,脱离修补程序。在如果只确定是否使用查询速度创建索引,请记住,图中只有8800个顶点,而TinkerGraph是内存中的图形。你可能看不到有几个顶点在速度上有明显的差别。如果您想知道索引是否已创建,只需查找:
相关问题 更多 >
编程相关推荐