[英]Should Different Nodes Be in Different Arango Collections?
I'm new to graphing databases and am looking at a POC in ArangoDb.我是图形数据库的新手,正在查看 ArangoDb 中的 POC。 What is the best practice when designing a database?
设计数据库时的最佳实践是什么? Specifically, should different but related node types be in seperate collections or in the same collection?
具体来说,不同但相关的节点类型应该在单独的集合中还是在同一个集合中? (Think of a classic "student/class/location/tutor" scenario.)
(想想经典的“学生/班级/地点/导师”场景。)
If the general consensus is to place everything in one collection then when would I need to consider multiple collections?如果普遍的共识是将所有内容都放在一个集合中,那么我什么时候需要考虑多个集合? Are there considerations for handling a high transaction rate, for example recording temperatures readings from a large number of devices?
是否需要考虑处理高事务率,例如记录大量设备的温度读数? Would this be a case for recording device information in one collection and readings in another?
这是在一个集合中记录设备信息而在另一个集合中读取的情况吗?
Yes, I'd suggest to put different node/vertex types in separate collections.是的,我建议将不同的节点/顶点类型放在不同的集合中。 So in your example you will have 4 vertex collections: "students", "classes", "locations" and "tutors".
因此,在您的示例中,您将有 4 个顶点集合:“学生”、“班级”、“地点”和“导师”。 Then you probably want to create some edge collections, eg "HasAttended", to store edges from "students" to classes.
然后您可能想要创建一些边缘集合,例如“HasAttended”,以存储从“学生”到类的边缘。
When designing the database, it may help to write down the data model on a piece of paper (or you can use a tool to visualize/edit it).在设计数据库时,将数据模型写在一张纸上可能会有所帮助(或者您可以使用工具对其进行可视化/编辑)。
I don't know your exact use case, but it makes sense to me to have a collection "devices" and another collection "temperatures".我不知道你的确切用例,但对我来说有一个集合“设备”和另一个集合“温度”是有意义的。 Then you can have an edge collection that stores edges between "devices" and "temperatures"
然后你可以有一个边缘集合来存储“设备”和“温度”之间的边缘
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.