0

I'm new to ArangoDB and was wondering to model a decentralized architecture using it. As it says in the documentation it supports multiple classes of DBs. I want to make a data model that will have multiple graphs as a small distributed system for let's say simulation purposes. Now once I have distributed system I want to query all these sources as one. For instance, we have 3 nodes in our distributed system: node 1 holds data for airports, node holds data for flights, and node 3 holds data for passengers. Now my question is can I query all three nodes by writing a single query or maybe multiple queries what I want is to hit multiple nodes from a single interface. Is it possible with ArangoDB?

  • If I'm not clear drop your query

1 Answers1

0

...can I query all three nodes by writing a single query...

The short answer is "yes", but with a big "it depends on your data model" asterisk. The shift from relational to graph can be strange, and it's all too easy to build a data set that doesn't scale well.

ArangoDB works by linking documents (nodes) using "edges", which are special documents that define link direction (to/from). Edge collections can be used to run queries (anonymous graphs) or can be "grouped" into more well-defined, elaborate graph definitions (named graphs). Your database can have many named graphs, each tailored to fit the collections you wish to query (as is the case with RDBMS, reducing the number of things to look at is the easiest way to increase performance).

Generally, you would make collections of things by a high-level type, and group membership can be defined either by attribute(s) on documents/edges or simply through edge connections. The best speed will be achieved by keeping your queries in-memory, which means staying away from filtering on non-indexed attributes.

From your question, it sounds like you want two collections ("airports" and "passengers"), along with an edge collection of "flights" (maybe a graph of "airport -> passenger -> airport"). This example demonstrates a simple actors/movies dataset that is designed to be graph-friendly, but there are many airport/trip graph samples on the interwebs.

The AQL language allows you to build complex queries, including multiple graphs and document calls, in the same query. As always, the main caveats are traversal complexity (see big-O notation) and memory usage.

These might be a good starting point for basic modeling information, from an ArangoDB perspective:

kerry
  • 757
  • 6
  • 16
  • Thanks @kerry I'll give this a try and comeback to you if find issue with your suggestion – Siraj Munir Jun 28 '22 at 23:06
  • Hi, @kerry sorry for being missing and just dropping in again. The problem is I want to arrange the data in different DBs not collections and then when I run a query from the AQL panel it hits all DBs and finds information that matches the query criteria – Siraj Munir Jul 14 '22 at 13:34
  • An AQL query runs in the context of a single database. It cannot access anything from other databases (it can't even see them, if you will). – CodeManX Jul 14 '22 at 19:03