Reputation: 103
Which is better in terms of read performance? I am currently working with arangoDB and, with regard to the multi model approach, I would like to know if it's faster to read data from few documents with multiply nested lists or to read from many (smaller) documents without nested lists, that are connected by multiple edges.
Example for a multiply nested document (really, it's not about a cocktail database):
{ "_key" : "cocktail/1", "name" : "newcocktail", "drinks" : [{ "orange juice" : [{"ingredient":"orange", "quantity":2},{"ingredient":"water", "amount":4},{"ingredient":"sugar", "quantity":6}], ...]}, }
Example without nested lists:
{ "_key" : "cocktail/1", "name" : "newcocktail" } { "_key" : "edge/1", "from" : "cocktail/1", "to" : "drink/1" } { "_key" : "drink/1", "name" : "orange juice" "quantity" : 2 } { "_key" : "edge/2", "from" : "drink/1", "to" : "ingredient/1" } { "_key" : "ingredient/1", "name" : "orange" "quantity" : 2 "unit" : .... }
Upvotes: 2
Views: 83
Reputation: 2764
If you are just interested in the raw read performance, then reading one large document will be faster.
If your documents are just values, the correct strategy with regards to the multi-model approach would indeed be embedding. If your documents are entities of their own right (which might change frequently; which are referenced from different places), than you should store them as separate documents.
Upvotes: 3