简体   繁体   中英

Should Different Nodes Be in Different Arango Collections?

I'm new to graphing databases and am looking at a POC in ArangoDb. 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". Then you probably want to create some edge collections, eg "HasAttended", to store edges from "students" to classes.

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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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