You are troubleshooting a performance issue with a Kusto Query Language (KQL) query used to retrieve telemetry from Application Insights. The query currently looks like this:
kql
requests
| where success == false
| summarize count() by bin(timestamp, 1h)
The query is taking a long time to run and occasionally exceeds resource limits because it scans all historical data.
Which of the following changes should you make to the query to improve performance and prevent resource limit issues?
- Add a where clause filtering by a timestamp range (e.g., | where timestamp > ago(24h)) immediately after the requests table.Cevap
- BAdd a where clause filtering by a timestamp range (e.g., | where timestamp > ago(24h)) as the last line of the query after the summarize operator.
- CAdd a take 100 clause at the end of the query to limit the number of returned rows.
- DEnsure that the Application Insights SDK connection string is configured in the query settings.
Cevap
Add a where clause filtering by a timestamp range (e.g., | where timestamp > ago(24h)) immediately after the requests table.
Filtering by timestamp early in the query pipeline restricts the dataset size processed by subsequent operators. In this query, adding the time filter immediately after the requests table ensures the query engine only scans the last 24 hours of data, preventing slow execution times and resource limit exhaustion.
Adım Adım Çözüm
Anahtar Kavram
KQL Query Optimization with Time-Range Filters
Tahmini Süre:1m 0s