0
votes

In my SQL-CosmosDB I am not using any queries with WHERE condition other than by a partition key + sort by additional field (so a streamId which is a partition key and event position, as I use Cosmos to store my aggragate roots).

I wonder what will happen if I just exclude all paths from indexing in that collection, except maybe keeping the field I am using for sorting.

1
It will decrease your index storage, probably save you some RU's also. Be aware that if you change index policy it will affect only new records - DraganB
Hi,if my answer helps you,please mark the answer to end it,thanks. - Jay Gong
@JayGong i am upvoting it :) - DraganB
@DraganB could you please share a reference where it says changing index policy affects only new records? tnx - dee zg

1 Answers

2
votes

Alexander,according to you requirements,i think you could consider setting the index mode as None.Please refer to the explanations in this link.

If a container's indexing policy is set to None, indexing is effectively disabled on that container. This is commonly used when a container is used as a pure key-value store without the need for secondary indexes. It can also help speeding up bulk insert operations.

Of course,you could choose excluding the root path to selectively include paths that need to be indexed if you have special needs. BTW, as mentioned by @DraganB in the comments,change index policy only affects new records,you could see the statements in this link. So it's better to deliberate at the initial time.