Clarification on synthetic partition key usage

Litty Kuriakose 106 Reputation points
2022-08-09T10:13:01.967+00:00

Hello Team,

I have a read heavy container (Total number of records ~300M,Distinct records for A ~20M,
Distinct records for B ~20K).A is chosen as the partition key. A large number of records with "" value for A is expected. But reads based on A="" are not expected. To solve the hot partition for "" value thinking of creating
a synthetic partition key by concatenating values of A and B.

Following are the main queries against the container.

Select from c where c.A=sample or c.B=sample
Select from c where c.A in (comma seperated values)

Please help me to understand if the synthetic partition key helps the above queries. How will the query identify the partition to be used? How will it affect the query performance?

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,611 questions
0 comments No comments
{count} votes

Accepted answer
  1. Anurag Sharma 17,606 Reputation points
    2022-08-10T05:23:22.46+00:00

    Hi @Litty Kuriakose , welcmoe to Microsoft Q&A forum.

    Using synthetic partition key seems like the right idea in this specific situation, however the queries mentioned above will not use the synthetic partition key because synthetic keys are created as concatenation of properties A and B (lets say "AB"), until we use "AB" in the queries it will not be used. As an example, below query will use the key:

    Select from c where c.AB = sample  
    

    Please let us know if this helps or we can continue the discussion.


1 additional answer

Sort by: Most helpful
  1. THIAGO ATAURI TURINI 1 Reputation point
    2022-08-17T22:14:22.663+00:00

    Certamente a produção do seu padrão de publicidade é em VCards.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.