What does each item in Cosmos DB statistics mean?

test29998411 301 Reputation points
2021-12-23T07:22:12.427+00:00

To collect the usage of each partition of Azure Cosmos DB, I ran the following command in the Azure CLI.

As a result, the following is returned as a response, but is there a document that describes the contents of each item?

In particular, I don't know what the item id in statistics means.

sh
$ az cosmosdb sql container show -n <container> -d <db> -a <account> -g <rg>



json
{
  "id": "/subscriptions/xxxx/resourceGroups/providers/Microsoft.DocumentDB/databaseAccounts/cosmos-account/sqlDatabases/test-db/tes-container",
  "location": null,
  "name": "test-container",
  "options": null,
  "resource": {
    "_conflicts": "conflicts/",
    "_docs": "docs/",
    "_sprocs": "sprocs/",
    "_triggers": "triggers/",
    "_udfs": "udfs/",
    "analyticalStorageTtl": null,
    "conflictResolutionPolicy": {
      "conflictResolutionPath": "/_ts",
      "conflictResolutionProcedure": "",
      "mode": "LastWriterWins"
    },
    "defaultTtl": null,
    "etag": "\"02000e57-0000-2300-0000-6168f37f0000\"",
    "geospatialConfig": {
      "type": "Geography"
    },
    "id": "test-cosmos-container",
    "indexingPolicy": {
      "automatic": true,
      "compositeIndexes": null,
      "excludedPaths": [
        {
          "path": "/\"_etag\"/?"
        }
      ],
      "includedPaths": [
        {
          "indexes": null,
          "path": "/*"
        }
      ],
      "indexingMode": "consistent",
      "spatialIndexes": null
    },
    "partitionKey": {
      "kind": "Hash",
      "paths": [
        "/partition-path"
      ],
      "systemKey": null,
      "version": null
    },
    "rid": "EpFgALliH9I=",
    "statistics": [
      {
        "documentCount": 189,
        "id": "0",
        "partitionKeys": [
          {
            "partitionKey": [],
            "sizeInKB": 7
          }
        ],
        "sizeInKB": 378
      }
    ],
    "ts": 1634268031.0,
    "uniqueKeyPolicy": {
      "uniqueKeys": []
    }
  },
  "resourceGroup": "rg",
  "tags": null,
  "type": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers"
}
Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,911 questions
0 comments No comments
{count} votes

Accepted answer
  1. Mark Brown - MSFT 2,771 Reputation points Microsoft Employee
    2022-01-04T16:45:41.917+00:00

    The data here is related to the physical partitions for a container.

    • Document count is the total number of documents in the physical partition.
    • Id is the partition key range id.
    • Partition keys is an array of partition keys inside the physical partition. Size in kb inside “partitionKeys” is total size of logical partition. (This is where you could find what you're looking for).
    • Size in kb is the total size of the physical partition.
    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Anurag Sharma 17,631 Reputation points
    2021-12-24T07:01:51.683+00:00

    Hi @test29998411 , welcome to Microsoft Q&A forum.

    We can get most of the details through any SDKs. Please refer to .NET SDK mentioned below.

    ContainerProperties Class

    However it still does not cover every single container response like statistics. Few properties are self-explanatory like documentcount, partitionkeys, sizeinKB. I tried running some tests from my side by creating multiple databases and containers but everytime 'id' value is set as 0.

    I can reach out to product group on the same if needed. Please let me know.

    1 person found this answer 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.