Reputation: 99
We have Task objects in Aerospike. Each task has list of dependent Task ids like:
TaskA = {id=TaskA, dependencies=['TaskB', 'TaskC']}
TaskB = {id=TaskB, dependencies=[]}
TaskC = {id=TaskC, dependencies=['TaskD']}
TaskD = {id=TaskD, dependencies=[]}
I'm looking for most efficient approach how to get all dependencies(including transient ones) in 1 query to aerospike. In our example query should return all 4 tasks.
Upvotes: 1
Views: 82
Reputation: 5435
You are trying to make a Graph Query. Aerospike, like all other popular NoSQL databases, is not a native graph database, hence does not offer index-free adjacency. i.e. Aerospike cannot traverse the links and send you just the results. You will have to pull each record into your application, read the next relationships, then read those individual records - i.e. traverse in the application.
Or alternatively - embed the entire "graph" data in a single record, if that works for you, data model wise. NoSQL modeling uses this "encapsulation" technique as an alternate to a flexible and extensible graph data model.
In the near future, Aerospike will be supported as a storage layer in a graph implementation and then you can store graph data models and run Gremlin queries with data storage on Aerospike. More here: https://medium.com/aerospike-developer-blog/are-graph-databases-finally-ready-for-prime-time-8f7ddd49a855
Upvotes: 1