Kat Lim Ruiz
Kat Lim Ruiz

Reputation: 2562

Azure CosmosDb create partition only

And probably I already know the answer, yet I would love some feedback.

I have a Azure CosmosDb without partition key (empty), I want to create one because the RUs are too high so the performance improves.

My would-be partition is Date (20181005).

My question is if I don't send the Date as part of the queries (most of the times we request the object by ID), will the partition help on the performance?

I believe that it will since physically will organize documents better, however, I would love some feedback.

Thanks

Upvotes: 0

Views: 70

Answers (1)

Nick Chapsas
Nick Chapsas

Reputation: 7200

The document id is only unique within it's own logical partiton. You can have multiple documents with the exact same id property as long as they are in different logical partitions.

If you partition your collection you have to deal with 2 (of many) realities.

  • The logical partition size cannot exceed 10GB
  • In order to have efficient queries and reads you have to provide the partition key value alongside your operations.

You can still do any querying operation using a cross partition query but this is something that should be avoided if possible. If you see yourself needing to use a cross partition query frequently then there is a problem with your partitioning strategy.

Bottomline is that your querying performance will be way worse without a partition key provided during the querying process.

Upvotes: 1

Related Questions