1
votes

Are there any performance penalties for having a heterogenous collection (with multiple, completely different, documents schema)?

e.g: If I have 1000 docs with the same schema, querying it will happen faster than if I had 500 docs with schema A and 500 docs with schema B?

1
did my supplied answer clear things up for you?Jesse Carter

1 Answers

2
votes

No, there are no penalties. By default all properties of your JSON documents are indexed automatically for you, so by filtering on a property like type you can easily filter down to distinct and varied document types inside the same collection. This is the way Cosmos is intended to be used.

Same screenshot as in your question about indexing policies but it is relevant here too because this topic comes up a lot with people investigating Cosmos. It's good to know that if you want to perform Order By queries the field you're ordering must be covered by an index precision of -1. This means that the default supports ordering on all numeric fields. If you intend to store dates as strings and order them you will need to modify the index paths to apply -1 meaning highest level of indexing.

enter image description here