Locality-Aware Query Planning for Cross-Region Latency Control

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Conventional query optimizers in distributed databases fail to account for network latency between geographically distributed regions, leading to suboptimal query plans and inability to prevent cross-region queries, which can result in poor performance and non-compliance with data regulations.

Innovation Solution

Implement locality-aware query planning by incorporating latency awareness into the cost model, generating candidate query plans that consider geographic regions and selecting the optimal plan based on lowest latency and computational costs, while preventing cross-region queries.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If conventional cost-based query optimization is used, then computational resource utilization is considered, but network latency between geographic regions is ignored leading to suboptimal query plans

Engineering Contradiction:
Improvequery execution efficiencyVSAvoidnetwork latency
Core Design Contradiction:
ProductivityVSLoss of time

Solution Approach 1:

The cost model parameters are extended to include network latency metrics alongside computational resource parameters. The optimizer now evaluates both computational cost and network latency when selecting query plans, changing the optimization criteria from purely computational to a hybrid metric that accounts for geographic distribution and network conditions.

Inventive Principle:
Principle #35Parameter changes

Solution Approach 2:

The query optimization problem is extended from a single-dimensional computational cost metric to a multi-dimensional evaluation space that includes both computational resources and network latency. This allows the optimizer to consider multiple factors simultaneously when generating and selecting query plans.

Inventive Principle:
Principle #17Another dimension (Dimensionality change)

2Ease of manufacture

If query plans are generated without locality awareness, then simpler optimization is achieved, but cross-region queries cannot be prevented resulting in regulatory non-compliance

Engineering Contradiction:
Improvequery plan generation simplicityVSAvoidcross-region query compliance violations
Core Design Contradiction:
Ease of manufactureVSObject-affected harmful factors

Solution Approach 1:

The optimization process incorporates locality information about data distribution and node locations to generate query plans that are aware of geographic considerations. The system evaluates query plans based on their interaction with specific localities (database regions) and adjusts selections accordingly to prevent cross-region queries that would violate compliance requirements.

Inventive Principle:
Principle #3Local quality

3Speed

If single-node optimized query plans are selected, then fast execution is achieved, but geographic data distribution requirements cannot be satisfied

Engineering Contradiction:
Improvequery execution speedVSAvoidgeographic data distribution adaptability
Core Design Contradiction:
SpeedVSAdaptability or versatility

Solution Approach 1:

The query optimization system dynamically adapts query plans based on the geographic distribution of data and nodes. Instead of selecting a fixed single-node plan, the system generates and evaluates multiple candidate plans that account for geographic considerations, allowing flexible adaptation to different data distribution scenarios while maintaining performance.

Inventive Principle:
Principle #15Dynamics

Data Source

PatentUS20260064685A1Systems and methods for locality-aware query optimization
Publication Date: 2026.03.05 COCKROACH LABS INC
  • US20260064685A1 patent drawing
  • US20260064685A1 patent drawing
  • US20260064685A1 patent drawing

AI summary

Methods and systems for locality-aware query planning in a distributed computing system are provided. A query is received from a client device at a gateway node geographically located in a first database region. A plurality of query plans for execution of the query are generated at the gateway node. A first query plan of the query plans is configured to cause communication between the gateway node and a subset of computing nodes that are geographically located in a first external database region that is external to the first database region. A respective cost for each of the query plans is determined. The respective cost for the first query plan is based on an indication of a latency between the first database region and the first external database region. An optimal query plan from the query plans is determined and executed based on each respective cost for the query plans.