Skip to content

We are seeing a severe regression in azure-cosmos Python SDK 4.16.0 for single-partition COUNT queries. #48209

Description

@ajmehul
  • azure-cosmos:
  • 4.16.0 and above:
  • Windows 11:
  • 3.14.5:

We are seeing a severe regression in azure-cosmos Python SDK 4.16.0 for single-partition COUNT queries.

Container:

  • Container id: power_generation
  • Partition key path: /documentType
  • Partition key kind: Hash

Query:
SELECT VALUE COUNT(1) FROM c

SDK call:
query_items(
query="SELECT VALUE COUNT(1) FROM c",
partition_key="PowerCut",
enable_cross_partition_query=False,
populate_query_metrics=True
)

Results with azure-cosmos==4.15.0:

  • Count: 30,735,986
  • Elapsed: 0.049 sec
  • Pages: 1
  • RU: 8.82
  • Continuation: None
  • retrievedDocumentCount: 0
  • retrievedDocumentSize: 0
  • indexUtilizationRatio: 1.00
  • Activity ID: 0899ada3-21d3-4273-9f83-ae075b91f69c

Results with azure-cosmos==4.16.0:

  • Count: 30,725,812
  • Elapsed: 191.923 sec
  • Pages: 49
  • Total RU: 506,961.75
  • Continuation present for pages 1-48
  • retrievedDocumentCount: ~626k per page
  • retrievedDocumentSize: ~168 MB per page
  • indexUtilizationRatio: 0.00
  • Activity ID: 8a09c368-ce86-4fea-bd41-5240d24cbce6

Expected:
The query should remain an index-only count within the supplied logical partition, as in 4.15.0.

Actual:
4.16.0 scans/loads documents page-by-page and consumes extremely high RU.

Metadata

Metadata

Assignees

Labels

ClientThis issue points to a problem in the data-plane of the library.CosmosService AttentionWorkflow: This issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

Status
No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions