AI-200 · 2.1.2 · Develop AI solutions by using Azure data management services
Cosmos indexing and RUs
Optimize query performance and Request Units (RUs) consumption by using indexing policies and consistency levels
Tune cost with selective indexing, , and the right , then verify with request charge and index metrics.
Three levers change RU cost

Cosmos DB indexes every property by default. Exclude paths you never filter or sort on to reduce write work. Multi-property ORDER BY queries need a with matching path order and directions.
Measure before tuning
Read the x-ms-request-charge response header to compare operations. Enable index metrics when you need to see which indexes a query used or could benefit from.
Consistency also affects cost and freshness. Session is the usual balance for application traffic. Strong and bounded staleness reads use more replicas and cost more than weaker levels.
An index policy change is online, but the new index helps only after transformation completes. Add the replacement first, wait, then remove the old path or index.
Key points
- : exclude unused paths for cheaper writes; root `/*` stays listed
- : paths follow ORDER BY order; same directions or all reversed
- Consistency: Strong, bounded staleness read at twice the ; Session is usual
- Measure: `x-ms-request-charge` gives RUs, `populate_index_metrics` lists used and potential indexes
Click an underlined term for a one-line explanation, or see them all in the glossary .
Exam trap
Stronger consistency is not free and more indexes are not better: Strong reads cost about twice as much, and each indexed path adds write cost.
Sources · 4 Microsoft Learn pages Show ▾
- Indexing policies (Azure Cosmos DB)
- Consistency level choices (Azure Cosmos DB)
- Find the Request Unit charge for a SQL query (Azure Cosmos DB)
- Indexing metrics (Azure Cosmos DB)
Checked on October 4, 2026. Report a problem
Go deeper on Microsoft Learn
- Indexing policies (Azure Cosmos DB)
- Consistency level choices (Azure Cosmos DB)
- Find the Request Unit charge for a SQL query (Azure Cosmos DB)
- Indexing metrics (Azure Cosmos DB)
Checked against Microsoft Learn on October 4, 2026. Report a problem with this card