Multi-step Query Plan Operator for Graph Database Execution

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Relational database systems face challenges in efficiently executing graph queries, particularly for shortest path queries, due to the need for recursive joins and custom conditional logic, which can lead to performance issues and error-prone code.

Innovation Solution

The implementation of a multi-step sequence query plan operator in a relational database system, which generates a query plan with an initial step, intermediate steps, and a final step, allowing for recursive operations and early termination conditions, thereby improving the execution of graph queries.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Adaptability or versatility

If recursive joins and custom conditional logic are used to execute graph queries in relational database systems, then graph query capability is achieved, but execution performance deteriorates and code becomes error-prone

Engineering Contradiction:
Improvegraph query capabilityVSAvoidexecution performance
Core Design Contradiction:
Adaptability or versatilityVSProductivity

Solution Approach 1:

The query execution process is segmented into distinct steps: graph query translation step, query plan generation step, and query execution step. The query plan itself is segmented into multiple phases including graph traversal phase, path evaluation phase, and result aggregation phase. This segmentation allows each phase to be optimized independently, improving overall execution performance while maintaining graph query capability.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

An intermediary query plan structure is introduced between the graph query language and the relational database execution engine. This query plan acts as a mediator that translates graph query concepts into optimized relational operations, enabling efficient execution without requiring custom conditional logic in the application layer.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Adaptability or versatility

If custom conditional logic is written to handle graph queries, then query flexibility is achieved, but code complexity increases and errors increase

Engineering Contradiction:
Improvequery flexibilityVSAvoidcode complexity
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The system performs self-service by automatically generating optimized query plans from high-level graph queries. The query plan generator autonomously translates graph query concepts into execution steps, eliminating the need for developers to write custom conditional logic. This maintains query flexibility while significantly reducing code complexity.

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The system changes parameters from custom code-based query execution to parameterized query plan execution. Instead of writing conditional logic, users specify query parameters (start nodes, end nodes, path constraints), and the system automatically generates the execution plan. This parameterization approach maintains flexibility while reducing complexity.

Inventive Principle:
Principle #35Parameter changes

3Adaptability or versatility

If recursive common table expressions are used to handle graph queries, then recursive query capability is achieved, but performance deteriorates

Engineering Contradiction:
Improverecursive query capabilityVSAvoidquery performance
Core Design Contradiction:
Adaptability or versatilityVSProductivity

Solution Approach 1:

The system performs preliminary action by pre-computing and caching graph traversal results during the query plan generation phase. The query plan generator analyzes the graph structure and pre-determines optimal traversal paths, which are then executed efficiently during query execution. This preliminary preparation eliminates the need for slow runtime recursive CTE operations.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The system replaces the mechanical recursive CTE mechanism with a more efficient query plan execution mechanism. Instead of using recursive SQL statements that process rows one by one, the system uses a phased execution approach with batch processing, significantly improving performance while maintaining recursive query capability.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

4Adaptability or versatility

If recursive joins are used to perform shortest path queries, then graph traversal is achieved, but execution time increases

Engineering Contradiction:
Improvegraph traversal capabilityVSAvoidexecution time
Core Design Contradiction:
Adaptability or versatilityVSLoss of time

Solution Approach 1:

The query execution uses periodic action by processing graph traversal in distinct phases: initialization phase, traversal phase, and termination phase. The traversal phase executes in iterative cycles where each cycle processes a specific depth level of the graph, rather than using continuous recursive joins. This periodic processing reduces execution time while maintaining complete graph traversal capability.

Inventive Principle:
Principle #19Periodic action

Solution Approach 2:

The system skips unnecessary join operations by using a phased execution approach. Instead of performing multiple sequential joins for each path level, the system pre-computes path candidates and then filters them in a single efficient operation, rushing through the execution process and reducing overall execution time.

Inventive Principle:
Principle #21Skipping (Rushing through)

Data Source

PatentUS12332889B2Multi-step query execution in SQL server
Publication Date: 2025.06.17 MICROSOFT TECHNOLOGY LICENSING LLC
  • US12332889B2 patent drawing
  • US12332889B2 patent drawing
  • US12332889B2 patent drawing

AI summary

Methods, systems, and computer program products are provided that construct and execute multi-step query plans in a database application. A database application accepts a query such as, for example, a graph query. The database application generates a physical query plan comprising a set of execution steps that perform the query. The set of execution steps comprises at least an initial step, an intermediate step and a final step. The database executes the query by passing control to the initial step that, when complete, passes execution control to some other step. The intermediate step executes and when complete, may pass execution control to any other step including itself. Steps may be configured to communicate arbitrary data between steps. The generated query plan may also comprise multiple multi-step sequences, and such sequences may be configured to execute in the alternative based on intermediate query results, or a parameter included in the query.