QuestionQ245

VerifiedCost & Performance Optimisation

A security analytics pipeline needs to enrich billions of raw connection logs with geolocation data. The join depends on identifying the IPv4 range into which each event address falls.

Question Image

The following query is running very slowly and must be improved:

Question Image

Execution is much too slow.

Which change would most dramatically speed up the query while preserving its logic?

Explanation

A numeric BETWEEN start_ip_int AND end_ip_int predicate is a point-in-interval range join. A RANGE_JOIN hint with a 65,536-value bin size enables bin-based range-join optimization, limiting candidate comparisons to IP ranges that overlap the event IP’s relevant numeric bin while retaining the original interval-match semantics. Databricks documents range-join optimization specifically for point-in-interval conditions and supports enabling it with a RANGE_JOIN hint and numeric bin size.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!