Practice Exam

Question 14 of 75

Optimize KQL Query Performance

You work for MDFT Pro, a well-known training agency that operates IoT-enabled smart classrooms across multiple campuses. Claire, a Real-Time Analytics Specialist at MDFT Pro, manages a KQL database that tracks environmental conditions in classrooms to ensure optimal learning environments. The database contains two tables: Stream (with millions of streaming sensor readings including timestamp, geolocation, temperature, and device ID) and Reference (with device information mapping device IDs to device names and locations). Claire has written a KQL query that joins these tables, extracts latitude and longitude from the geolocation data, filters for temperatures above 10 degrees, and renders the results on a map. However, the query takes too long to execute because it processes millions of rows through the join operation before applying the temperature filter. The current query looks like this:

Stream
| extend lat = todecimal(GeoLocation.Latitude), long = todecimal(GeoLocation.Longitude)
| join kind = inner Reference on DeviceId
| project Timestamp, lat, long, Temperature, DeviceName
| filter Temperature >= 10
| render scatterchart with (kind = map)

Claire plans to move the temperature filter to line 02 (right after the extend operation, before the join) to reduce the number of rows processed during the join.

Does this solution meet the goal of reducing query execution time?

Choose the correct answer from the options below.

Explanations for each answer:

Learn more about KQL querysets:
KQL Querysets
Next Question
Discuss this question on social media: