skip to Main Content

I am unable to find any documentation mentioning how are cosmos db indexes organized per the number of physical partitions. If i have my logical partition split into multiple physical partitions and assuming i am not including a partition key in the filter and have created an index on the field i am querying with.
What would the behavior be in terms of index. Does cosmos create an individual index per physical partition or a centrally maintained global index?

Can someone please explain what the behavior could be in such a case or point to some documentation in azure which explains how this would work.

2

Answers


  1. Perhaps this ms learn article provides the information you are looking for or this one for more details.

    1. A Logical partition is mapped to only one physical partition;
    2. Physical partitions are an internal implementation of the system and they are entirely managed by Azure Cosmos DB.
    3. Azure Cosmos DB will automatically create new physical partitions by splitting existing ones

    enter image description here

    Kind regards

    Login or Signup to reply.
  2. A physical partition is simply a compute and storage node on which your data resides. A partition key within your WHERE clause routes the query to the partition where that data resides. Indexes reside within each partition and index the data for that partition only. Partitions are share nothing. In addition to routing, partition keys must also be included in your index policy when used in queries.

    A query without a partition key in the filter will fan out to every partition within a container. At small scales (< 10K RU/s or < 50GB) this isn’t much of an issue because the data is all located on a single physical partition. However, as the amount of storage and throughput grows, this query will likely become increasingly more expensive with greater latency. In short, the query will not scale. This is because as the size grows, so does the number of physical partitions that must be contacted to serve the same query.

    More information here, Tuning query performance with Azure Cosmos DB and here, Indexing Overview

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