Locality-Aware Query Planning Using Regional Latency Cost Models

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Conventional query optimizers in distributed databases lack locality awareness, failing to account for network latency between geographically distributed regions, leading to suboptimal query plans and inability to prevent cross-region queries.

Innovation Solution

Locality-aware optimizers that consider geographic latencies and computational costs to select optimal query plans, preventing cross-region queries by generating and evaluating candidate plans based on latency-aware cost models.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If conventional query optimizers are used that ignore geographic latency, then query planning is simpler and faster, but query execution performance deteriorates due to suboptimal plans in distributed regions

Engineering Contradiction:
Improvequery execution performanceVSAvoidquery optimizer complexity
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The system pre-computes and stores latency values between different database regions before query optimization. This preliminary action allows the query optimizer to access pre-calculated latency data without performing complex real-time calculations, thereby improving query execution performance while avoiding the need for complex runtime computations.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent introduces an intermediary latency matrix that mediates between the query optimizer and the distributed database regions. This latency matrix serves as an intermediate data structure that captures geographic latency information, allowing the optimizer to make informed decisions without directly modeling complex geographic relationships.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Adaptability or versatility

If cross-region queries are allowed without locality awareness, then query versatility is improved, but network latency increases significantly

Engineering Contradiction:
Improvequery flexibilityVSAvoidnetwork latency
Core Design Contradiction:
Adaptability or versatilityVSLoss of time

Solution Approach 1:

The query optimizer dynamically adjusts query plan selection based on real-time latency conditions and data locality. Instead of using static query plans, the system evaluates multiple candidate plans and selects the optimal one based on current latency measurements and data location, thereby maintaining query flexibility while minimizing network latency.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The system prioritizes local data access by preferring query plans that access data within the same database region. When data must be accessed from remote regions, the optimizer uses pre-computed latency information to select the least-latent path, thereby reducing network latency while maintaining query versatility.

Inventive Principle:
Principle #3Local quality

3Measurement precision

If optimizers evaluate all candidate query plans without latency awareness, then plan selection thoroughness is improved, but computational overhead increases

Engineering Contradiction:
Improvecost estimation accuracyVSAvoidcomputational resource utilization
Core Design Contradiction:
Measurement precisionVSUse of energy by moving object

Solution Approach 1:

The patent changes the cost model parameters used by the query optimizer to include latency-aware cost calculations. By modifying the cost estimation parameters to incorporate pre-computed latency values, the system achieves more accurate cost estimation without requiring additional computational resources for complex real-time calculations.

Inventive Principle:
Principle #35Parameter changes

Solution Approach 2:

The system pre-computes latency values and stores them in a latency matrix before query optimization. This preliminary computation allows the optimizer to use accurate latency data during query plan evaluation without performing expensive real-time calculations, thereby improving cost estimation accuracy while reducing computational overhead during query execution.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS12488000B2Systems and methods for locality-aware query optimization
Publication Date: 2025.12.02 COCKROACH LABS INC
  • US12488000B2 patent drawing
  • US12488000B2 patent drawing
  • US12488000B2 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.