Azure Cosmos DB query optimization best practices: point reads, projections, pagination with continuation tokens, parameterized queries, filter ordering, cross-partition query avoidance, and analytical query detection. USE FOR: Cosmos DB queries, point reads vs queries, SELECT projections, continuation tokens, parameterized queries, avoid cross-partition, avoid scans, filter selectivity, TOP literal, ORDER BY, latest by timestamp, OLAP detection, aggregate queries, DISTINCT keyword. DO NOT US...
Scanned 9/11/2026
Install to Claude Code
npx -y skills add atc-net/atc-agentic-toolkit --skill cosmosdb-query-optimization --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Cosmosdb Query Optimization?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/atc-net-cosmosdb-query-optimization)More formats (shields.io, HTML) on the badges page.
---
name: cosmosdb-query-optimization
description: >
Azure Cosmos DB query optimization best practices: point reads, projections,
pagination with continuation tokens, parameterized queries, filter ordering,
cross-partition query avoidance, and analytical query detection.
USE FOR: Cosmos DB queries, point reads vs queries, SELECT projections,
continuation tokens, parameterized queries, avoid cross-partition, avoid scans,
filter selectivity, TOP literal, ORDER BY, latest by timestamp, OLAP detection,
aggregate queries, DISTINCT keyword.
DO NOT USE FOR: indexing (use cosmosdb-indexing), data modeling (use cosmosdb-data-modeling),
SDK client code (use cosmosdb-sdk).
---
# Azure Cosmos DB Query Optimization
Best practices for writing efficient queries against Azure Cosmos DB.
## When to Apply
Reference these guidelines when:
- Writing or optimizing Cosmos DB queries
- Implementing pagination
- Choosing between point reads and queries
- Reducing RU consumption on read operations
- Handling aggregations and sorting
## Rules
- [query-point-reads](references/query-point-reads.md) - Use point reads when id and partition key are known
- [query-aggregate-single-pass](references/query-aggregate-single-pass.md) - Compute min/max/avg with one scoped aggregate query
- [query-avoid-cross-partition](references/query-avoid-cross-partition.md) - Minimize cross-partition queries
- [query-use-projections](references/query-use-projections.md) - Project only needed fields
- [query-pagination](references/query-pagination.md) - Use continuation tokens for pagination
- [query-avoid-scans](references/query-avoid-scans.md) - Avoid full container scans
- [query-parameterize](references/query-parameterize.md) - Use parameterized queries
- [query-order-filters](references/query-order-filters.md) - Order filters by selectivity
- [query-top-literal](references/query-top-literal.md) - Use literal integers for TOP
- [query-latest-by-timestamp](references/query-latest-by-timestamp.md) - Query latest documents with ORDER BY and TOP 1
- [query-olap-detection](references/query-olap-detection.md) - Detect and redirect analytical queries
- [query-distinct-keyword](references/query-distinct-keyword.md) - Use DISTINCT keyword correctly

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!