I'm modeling out my ArangoDB database and the list of edge collections I've created is growing and growing. I could just combine all of the edges into a single edge collection called relations with a type parameter. It would certainly clean up my list of tables but would it have any effect on my traversal queries? Would it have any positive or negative effects?
2
votes
1 Answers
1
votes
You should add a vertex-centric index for the edge collection. This allows you to use a single edge collection without a big performance impact.
You can essentially add indexes on the "_from" or "_to" field and your type
attribute.
If your traversal queries need both directions you need to add two indexes one on "_to"+"_type" and one on "_from"+"_type"
The example in the documentation just suggests a skiplist index, but you should probably use a hash-index because the type
field contains a discrete value.
https://docs.arangodb.com/3.2/Manual/Indexing/IndexBasics.html#vertex-centric-indexes