Launch price: every exam for $29.99 a year, for the first 300 buyers. See the price

CertStreak
Menu

Analyze query performance metrics

A worked example

Single answer

A .NET application that uses the Azure Cosmos DB .NET SDK version 3.36.0 or later runs a parameterized query. Across all pages of one execution, you record these values:

  • a total request charge of 3.1 RU
  • RetrievedDocumentCount and OutputDocumentCount are both 14
  • CumulativeMetrics.TotalTime values sum to 4 ms

The application's own timer shows that the query call takes about 900 ms.

Which conclusion do these measurements support?

Choose one answer
Why

TotalTime covers server-side execution only. Here the request charge is modest and server time sums to 4 ms, yet the call takes about 900 ms, so almost all of the latency happens outside the query engine. The guidance is to look at network transit and client-side processing. Also check the SDK diagnostics for retries, because throttling delays can add end-to-end latency without increasing server-side execution time.

  • Not correct: Server-side execution is expensive and needs more provisioned throughput. A charge of 3.1 RU is modest. Together with the small TotalTime, it shows that server-side execution is cheap and fast, so it does not explain the slow call.
  • Not correct: Most of the delay is spent loading documents off the physical partition. DocumentLoadTime is part of server-side execution, and all server-side execution totals only 4 ms. Document loading cannot account for a 900 ms call.
  • Not correct: The engine loads many documents that the filter then discards. The metrics show 14 documents retrieved and 14 output, so these counts give no evidence of large-scale document loading followed by filtering.
  • Correct: Most of the delay occurs outside server-side query execution. TotalTime measures only server-side work. With a modest charge and 4 ms of server time against a 900 ms call, the delay lies elsewhere. Network transit, client-side processing and SDK retries are the places to inspect.

Practise this topic until it's automatic.

Ten questions a day, every answer explained, and misses that come back until you beat them.

Start free