performancespring-bootquery-optimizationarangodb

Performance Issue i Arango query while returning the whole Object


I am new to ArangoDB . Needed some help in improving performance of a query .

Tech specs: ArangoDb(3.6.2) , Java 8 Springboot application(2.xx) .

I am trying to run a query where it returns an object after merging data from couple of Graphs . The query runs infinitely when i directly return the object , where it runs faster(like 75 secs) when i just return an element of the object .

for d in data
        return d

Output:

[{
accntDtl:{ //account detials here
         },
accntPrfl:{//accnt profile here
            },
//few other parameters
}]

return d - runs infinitely .

whereas, return d.accnt[0].accntDtl[0].accntId - executes in 75 secs..

What can be a possible solution to increase its performance ?

Note: This query returns around 2 million record .

For confidentiality purpose , i am unable to post the whole query here .

Thanks in advance .

Updates: Included AqlQueryOptions for streaming .

aqlQueryOptions.stream(true),aqlQueryOptions.batchSize(10000)

Consuming the same :

while(cursor.hasNext()){
  result = cursor.next();
  //deserilize result as doc
  resultList.add(doc)
  ..... processing the data
}

But this iteration is happening 1 by 1 and not in a batch of 10,000 as specified in the batchSize param . I am pretty sure, the way am consuming the cursor is not advisable . Kindly suggest the best way to consume this data in a batch of 10,000 at each iteration .


Solution

  • For such query would be beneficial using a streaming cursor, setting stream to true on AQL cursor creation.

    Here is the reference documentation: