OrientDB SQL与Gremlin [英] OrientDB SQL vs Gremlin

查看:150
本文介绍了OrientDB SQL与Gremlin的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OrientDB中的哪种查询语言提供了最快的解决方案:SQL或Gremlin? Gremlin非常吸引人,因为它在其他图形库中通用,但是这需要在OrientDB中进行大翻译还是根本不需要翻译(延迟是多少)?

What query language in OrientDB provides the fastest solution: SQL or Gremlin? Gremlin is very attractive because it is universal for other graph libraries, however does this require a big translation in OrientDB or none at all (What is the latency)?

推荐答案

编辑 正如@decebal指出的那样,这不是一个好的测试案例. 请舍弃以下基准.

EDIT As @decebal pointed out this is not a good test case scenario. Please discard the below benchmarks.

图数据库的力量来自关系,那些查询是 显然偏向于简单的结构,这反映了唯一的 结论是,当您需要简单的数据结构时,您会更好 使用文档而不是图形...无法比较苹果和梨

power of a graph database comes from relationships, those queries are obviously biased towards simple structures which reflects the only conclusion that when you want simple data structures you are better of using documents rather than graphs... can't compare apples with pears

========

我运行了一些测试,SQL明显更快. 我使用的代码:

I ran some tests and SQL is noticeably faster. The code I used:

long startTime = System.currentTimeMillis();

// Object ret = orientGraph.command(new OCommandGremlin("g.v('9:68128').both().both()")).execute();
String oSqlCommand = "SELECT expand(out().out()) FROM V where user_id='9935'";
Object ret = orientGraph.command(new OCommandSQL(oSqlCommand)).execute();
Iterable<Vertex> vertices = (Iterable<Vertex>) ret;

long endTime = System.currentTimeMillis();
long operationTime = endTime - startTime;
System.out.println("Operation took " + operationTime + " ms");

我只是Wikitalk数据集. Gremlin命令大约花费了42541秒,而SQL命令平均只花费了1831 ms.

I just the wikitalk dataset. The Gremlin command took around 42541 seconds whereas the SQL command took just 1831 ms on average.

测试是在Linux Debian 64位VM 4GB RAM,1024MB堆,2048MB磁盘缓存上运行的.

Tests were run on Linux Debian 64-bit VM 4GB RAM, 1024MB Heap, 2048MB diskcache.

这篇关于OrientDB SQL与Gremlin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆