3

Assume we have a person and activity searchdefinitions. To find a the activities made by a person once can use the array type and match:word (many person can share the same activity) in the activity sd and then simply search for the person in the query.

Is this better for query performance than include a reference of the userID or name in the activity sd ?

Kind of the analogy to the common NoSQL document DB query, if one should include it in the document itself or using a linking document.

Thanks!

Lundin
  • 301
  • 4
  • 14

1 Answers1

3

In terms of query performance, it is generally better to stay away from document references (parent/child). The real advantage of parent/child is when you have (relatively) frequent updates to the parent documents and the number of child documents are too many to efficiently update all of them.

So rule of thumb; for query performance, "flatten" your data (de-normalize) and be happy.

Frode Lundgren
  • 336
  • 1
  • 4