QueryRuntimeStatistics (Diagnostic Log)

From Ilianko
Revision as of 15:07, 26 October 2026 by Anko (talk | contribs) (Recreated DP-420 term page: QueryRuntimeStatistics (Diagnostic Log) (Maintenance & Security))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

← Back to DP-420 Terminology Reference

Category: Maintenance & Security

Summary: Logs query operations against the account for query performance analysis.

Overview

QueryRuntimeStatistics is a diagnostic log table that logs query operations executed against an Azure Cosmos DB for NoSQL account, including details useful for analyzing query text, RU charge, and execution performance. It is commonly used alongside query metrics to identify expensive or inefficient queries that may benefit from indexing policy or query rewrites. In Log Analytics, this table is exposed under the name CDBQueryRuntimeStatistics.

Example (KQL): Find the most expensive queries and their text

CDBDataPlaneRequests
| where todouble(RequestCharge) > 10.0
| project ActivityId, RequestCharge
| join kind=inner (
    CDBQueryRuntimeStatistics
    | project ActivityId, QueryText
) on $left.ActivityId == $right.ActivityId
| order by RequestCharge desc
| limit 100

This query joins CDBDataPlaneRequests (RU charge per request) with CDBQueryRuntimeStatistics (the query text) on the shared ActivityId, filters for requests costing more than 10 RUs, and returns the 100 most expensive queries together with their full query text — a common first step when troubleshooting unexpectedly high RU consumption.

More Info & Links

DP-420 Style Practice Questions

Q1. What does the QueryRuntimeStatistics diagnostic log table capture?

  • A. Details of query operations run against an Azure Cosmos DB for NoSQL account
  • B. Per-partition storage size in KB
  • C. Control-plane operations like adding a region
  • D. Change feed consumer lag

Q2. Why would you review QueryRuntimeStatistics during optimization?

  • A. To identify expensive or inefficient queries that might need indexing policy changes or rewrites
  • B. To determine which partition key value has the most storage
  • C. To check which regions accept writes
  • D. To view the account's backup retention window

Answer Key

Answers are listed at the very end so you can attempt the questions first.

  • Q1 (QueryRuntimeStatistics (Diagnostic Log)): A. Details of query operations run against an Azure Cosmos DB for NoSQL account — QueryRuntimeStatistics logs details about queries executed against the account, useful for query performance analysis.
  • Q2 (QueryRuntimeStatistics (Diagnostic Log)): A. To identify expensive or inefficient queries that might need indexing policy changes or rewrites — This table helps surface costly or slow queries so their indexing policy or query text can be optimized.

DP-420: Designing and Implementing Cloud-Native Applications Using Microsoft Azure Cosmos DB — term detail page