简体   繁体   English

ArangoDB 边缘建模

[英]ArangoDB Edge Modelling

I'm modeling out my ArangoDB database and the list of edge collections I've created is growing and growing.我正在对我的 ArangoDB 数据库进行建模,并且我创建的边缘集合列表越来越多。 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?它会产生任何积极或消极的影响吗?

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.您基本上可以在“_from”或“_to”字段和您的type属性上添加索引。 If your traversal queries need both directions you need to add two indexes one on "_to"+"_type" and one on "_from"+"_type"如果您的遍历查询需要两个方向,您需要添加两个索引,一个在“_to”+“_type”上,一个在“_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.文档中的示例仅建议使用跳过列表索引,但您可能应该使用哈希索引,因为type字段包含离散值。

https://docs.arangodb.com/3.2/Manual/Indexing/IndexBasics.html#vertex-centric-indexes https://docs.arangodb.com/3.2/Manual/Indexing/IndexBasics.html#vertex-centric-indexes

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM