Skip to content
Back to skills

Cosmosdb Query Optimization

ASecurity

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...

  • 5 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 11, 2026
ai-agentsazure

Works with

  • cli

Security analysis

A100/100

Pro scans all 13 files and shows the line behind each finding

Scanned September 11, 2026

npx -y skills add atc-net/atc-agentic-toolkit --skill cosmosdb-query-optimization --agent claude-code

Installs 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 with every re-scan.

Security grade badge for Cosmosdb Query Optimization
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/atc-net-cosmosdb-query-optimization/badge)](https://www.skillsdirectory.com/skills/atc-net-cosmosdb-query-optimization)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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

Files in this skill

  • SKILL.md2.2 KB
  • references/query-aggregate-single-pass.md2.7 KB
  • references/query-avoid-cross-partition.md4.3 KB
  • references/query-avoid-scans.md2.5 KB
  • references/query-distinct-keyword.md2.3 KB
  • references/query-latest-by-timestamp.md2.2 KB
  • references/query-olap-detection.md4.9 KB
  • references/query-order-filters.md2.6 KB
  • references/query-pagination.md7.7 KB
  • references/query-parameterize.md3.7 KB
  • references/query-point-reads.md8.4 KB
  • references/query-top-literal.md1.9 KB
  • references/query-use-projections.md5.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.