Cosmos db Data in Single container vs multiple Container due to high Volume

Mathew James 421 Reputation points
2023-07-03T18:59:09.39+00:00

Hi Everyone -

I have a Login table (with Mobile Number (Row Key), App Type (Partition Key) OTP, OTP Timer etc ( < 10 fields).

I will be having almost 100 million records.

The question is -

  1. Do i need to Store all of this in One Container in Cosmos DB or
  2. Do I need to Put in Multiple Container (based on Partition Key which is my App Type)

Note:- I will be having around 20 Apps. I will be using a Database Shared throughput of Rus.

Any thoughts ?

Thanks in Advance!
-Mathew James

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

Accepted answer
  1. AirGordon 7,145 Reputation points
    2023-07-03T19:09:51.19+00:00

    PartitionKey is a part of the container, so you should use a single container which is partitioned how ever you require.

    Assuming all apps create an equal volume of login requests - then AppId sounds reasonable as a partition key.

    https://learn.microsoft.com/en-us/azure/cosmos-db/resource-model#azure-cosmos-db-containers

    0 comments No comments

0 additional answers

Sort by: Most helpful

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.