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)?
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
========
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");
I just the wikitalk dataset. The Gremlin command took around 42541 seconds whereas the SQL command took just 1831 ms on average.
Tests were run on Linux Debian 64-bit VM 4GB RAM, 1024MB Heap, 2048MB diskcache.