OrientDB query way too slow

640 views Asked by At

I can execute this query below just fine through web interface. It takes virtually no time at all to finish.

SELECT from Person;

But when I try to do it from my Java application, it takes more than 17 seconds to finish.

The code I'm using is basically this two lines:

OrientGraph graph = new OrientGraph("remote:93.x.x.x/test");
OCommandRequest req = graph.command(new OCommandSQL(query));
req.execute();

Could it be that the REST requests are so much slower? Web interface is using plocal (I guess), while my Java app uses remote connection.

1

There are 1 answers

1
lsavio On

Try to run the same query also from the console. The time spent in the console should be about the same (just a little slower than that in java). I did a test inserting 100,000 Vertex class Person. Doing various query response times is: Studio = 7.72 sec, Console = 2,043 sec, Java = 1:23 to 1:41 sec enter image description here

If revenues from a very different time, perhaps something is wrong in java. You have shown "OCommandSQL", check with "OSQLSynchQuery" to see if there is a great difference.

    String query = "";
    Iterable<Vertex> result;

    query = "select from Persona";

    //query with OSQLSynchQuery
    result = g.command(new OSQLSynchQuery<Vertex>(query)).execute();
    List<OrientVertex> listVertex = new ArrayList<OrientVertex>();
    CollectionUtils.addAll(listVertex, result.iterator());

    //query with OCommandSQL        
    OCommandRequest req = g.command(new OCommandSQL(query));
    req.execute();