You are analyzing telemetry for a high-volume e-commerce API hosted on Azure. You need to identify requests processed within the last 12 hours where the cumulative duration of all associated external dependency calls accounts for more than 75% of the total request duration. The telemetry database contains millions of records per hour, and your query must be optimized to prevent execution timeouts and minimize data scan limits. Which of the following Kusto Query Language (KQL) queries should you use?
- let start = ago(12h);
let dep_metrics = dependencies
| where timestamp > start
| summarize total_dep_duration = sum(duration) by operation_Id;
requests
| where timestamp > start
| join kind=inner dep_metrics on operation_Id
| where total_dep_duration > (duration * 0.75)
| project operation_Id, name, duration, total_dep_durationCevap - Blet start = ago(12h);
let dep_metrics = dependencies
| summarize total_dep_duration = sum(duration) by operation_Id;
requests
| where timestamp > start
| join kind=inner dep_metrics on operation_Id
| where total_dep_duration > (duration * 0.75)
| project operation_Id, name, duration, total_dep_duration - Clet start = ago(12h);
let dep_metrics = dependencies
| where timestamp > start
| summarize total_dep_duration = sum(duration) by operation_Id;
requests
| join kind=inner dep_metrics on operation_Id
| where timestamp > start
| where total_dep_duration > (duration * 0.75)
| project operation_Id, name, duration, total_dep_duration - Ddependencies
| summarize total_dep_duration = sum(duration) by operation_Id
| join kind=inner (requests) on operation_Id
| where timestamp > ago(12h)
| where total_dep_duration > (duration * 0.75)
| project operation_Id, name, duration, total_dep_duration
Cevap
The query that filters both the dependencies and requests tables by the 12-hour timestamp before performing the inner join.
The correct query applies the timestamp filter to both the dependencies table and the requests table prior to the join operation. In Kusto, filtering data as early as possible in the query pipeline reduces the CPU and memory footprint, which is critical for querying high-volume telemetry tables without exceeding resource limits or causing query timeouts.
Adım Adım Çözüm
Anahtar Kavram
Optimizing KQL queries in Azure Monitor by applying time-range filters early on all tables before performing joins.