2

What's better to retrieve complex data from ArangoDB: A big query with all collection joins and graph traversal or multiple queries for each piece of data?

Community
  • 1
  • 1

1 Answers1

3

I think it depends on several aspects, e.g. the operation(s) you want to perform, scenario in which the querie(s) should be executed or if you favor performance over maintainability.

AQL provides the ability to write a single non-trivial query which might span through entire dataset and perform complex operation(s). Dissolving a big query into multiple smaller ones might improve maintainability and code readability, but on the other hand separate queries for each piece of data might have negative performance impact in the form of network latency associated with each request. One should also consider if the scenario allows to work with partial results returned from database while the other batch of queries is being processed.

yojimbo87
  • 65,684
  • 25
  • 123
  • 131
  • Ok, this make sense. But I'll give a real scenario to try get a more detailed solution. I have three graphs keeping the relations between my nodes and two big collections with business information about each node. The filters consider basically temporals fields (datetime values). I get the state of each node from the graphs for time passed and get the information in the collection also for the same time. I have some servers but one them have just 1Gb RAM, in it this query is performed in 11 second. I think this is too much time. – Helder Santana Jan 28 '15 at 14:36
  • @HelderSantana Try to post this scenario on ArangoDB google groups with description you mentioned in the last comment since this might be a longer discussion about specific solution. – yojimbo87 Jan 28 '15 at 15:17