skip to Main Content

I have a container that stores ~5000 documents. Each document is not very large. The most frequent query is just to select everything in this container (so that the frontend can display it in a nice table client-side). Each document has a unique ID. I was using this as the partition key (/id) for the container but I have read that querying data like this is more efficient in terms of time and RU/s when all the data comes from the same partition as I can avoid cross-partition queries.

Can I create a container without a partition key? Or a container that only has one partition? Will I have to add a property to every document that is the same value to force this or is there an easier way?

2

Answers


  1. The number of partitions of a container is defined by the provisioned RU and data size: https://learn.microsoft.com/azure/cosmos-db/partitioning-overview#physical-partitions

    So, if you create a container with less than 10K RU and keep the data size small (<50GB), it should be a single physical partition.

    If you use a single value for your Partition Key, you will hit the data cap: https://learn.microsoft.com/azure/cosmos-db/sql/troubleshoot-forbidden#partition-key-exceeding-storage because your database simply won’t be able to scale.

    Login or Signup to reply.
  2. Looking at the no of documents in your container (~5000), it would ideally land in a single physical partition unless you have huge amount of RU requirement above 10,000 RU’s. Assuming you have an RU config of less than 10,000 RU/S, this would be in a single physical partition >You can confirm this by looking at the metric(classic) option from the left-hand blade in the portal

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search