0

i'm evaluating ArangoDb for my application. I have a data model like a file system, with a Items document collection and a ItemsParents edge collection with parent-child relations about Items.

Now i would like to find all childs of a specific item, with a specific attribute

Ex: All childs of A with property Properties.Age.Value = 20

so i created an hash index over Items.Properties.Age.Value, and design this AQL query:

FOR item 
    IN GRAPH_NEIGHBORS('ItemsGraph', 'Items/A', 
       { direction : 'outbound', 
         includeData: true,
         neighborExamples : { 'Properties.Age.Value': 20 }
       })
RETURN { Id: item._key, Name: item.Name } 

the above query work well, but no index are used, so it perform a full scan of Items collection for test Properties.Age.Value filter.

How to design the query so that it performance efficiently using index and avoid a collection scan?

Thanks

Community
  • 1
  • 1
Claudio
  • 133
  • 2
  • 11

1 Answers1

3

Currently ArangoDB can only utilize edge indices in graph operations;

Not using GRAPH_NEIGHBOURS may offer using the index, but then you would have to filter for neighbours yourself.

Vertex centric indices, which would offer that kind of index-support may arive in one of the next two ArangoDB Releases.

[edit] Meanwhile this is possible with newer ArangoDB releases.

GRAPH_NEIGHBOURS was integrated into the traversal engine. You would now create a combined index on Age and _from. You should use db._explain() to inspect the usage of indices.

dothebart
  • 5,972
  • 16
  • 40