Gregory Suvalian
Gregory Suvalian

Reputation: 3832

Is it better have high cardinality of partition key?

My understanding it's good to have high cardinality for choosing partition key. What I'm confused is how this impacts RUs. If you have cardinality partition key and you say issue update for specific value of partition key it would mean that all traffic will go into single partition and create "hot" partition and this will result in rate limiting per microsoft docs.

Upvotes: 0

Views: 1484

Answers (1)

Nick Chapsas
Nick Chapsas

Reputation: 7200

Your partition key should be a value that is guaranteed to have as many different values as possible while you still have the ability to provide this value on every query. It should also be a value that is as evenly distributed between your documents as possible. You don't wanna have 5GB worth of documents in one partition thats begin hit all the time and then partitions withs 100 MB that barely get hit. This is because RUs are distributed evenly between your partitions no matter what and you will be wasting RUs or causing hot partitions (as you mentioned yourself.)

This is a bad distribution model for your partition values:

enter image description here

This is a good example:

Upvotes: 1

Related Questions