Database Query Plan Caching Through Dynamic Filter Validation

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Database systems often fail to support caching or abstract query plans that include dynamic conditions, leading to inefficient query performance due to repeated compilation, which affects stability and efficiency.

Innovation Solution

Implement caching and persistency solutions to manage query plans with dynamic conditions by collecting and normalizing dynamic conditions as unified filter strings, and persisting them in a serialized format for reuse, allowing query plans to be cached and retrieved efficiently.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If query plans with dynamic conditions are not cached, then query security and adaptability are maintained, but query performance deteriorates due to repeated compilation

Engineering Contradiction:
Improvequery performanceVSAvoidquery plan validity
Core Design Contradiction:
ProductivityVSReliability

Solution Approach 1:

The system performs preliminary validation of dynamic conditions against cached query plans before execution. By checking whether current dynamic conditions match stored plan conditions in advance, the system determines whether to reuse cached plans or compile new ones, preventing unnecessary compilation while ensuring security

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The system changes the parameter of query plan storage from static to dynamic by incorporating dynamic condition information into cached query plans. This allows the same cached plan to be valid under different dynamic conditions by storing and validating the condition parameters, thereby enabling caching without sacrificing security

Inventive Principle:
Principle #35Parameter changes

2Productivity

If query plans are cached without dynamic condition validation, then query performance improves, but query security deteriorates due to potential unauthorized data access

Engineering Contradiction:
Improvequery performanceVSAvoidunauthorized data access
Core Design Contradiction:
ProductivityVSObject-affected harmful factors

Solution Approach 1:

The system implements feedback by validating dynamic conditions against cached query plans before reuse. The validation process provides feedback on whether the current user's dynamic conditions match the stored plan conditions, allowing the system to securely determine whether cached plans can be reused without compromising authorization

Inventive Principle:
Principle #23Feedback

Solution Approach 2:

The system performs preliminary validation of dynamic conditions against cached query plans before execution. By checking whether current dynamic conditions match stored plan conditions in advance, the system determines whether to reuse cached plans or compile new ones, preventing unauthorized data access while maintaining performance

Inventive Principle:
Principle #10Preliminary action

3Productivity

If dynamic conditions are not normalized and stored, then query plan simplicity is maintained, but query performance deteriorates due to repeated compilation

Engineering Contradiction:
Improvequery performanceVSAvoidquery plan structure
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The system changes the representation of dynamic conditions by normalizing them into a unified filter string format. This parameter transformation allows complex dynamic conditions to be stored in a standardized manner that enables efficient caching and validation while maintaining plan simplicity

Inventive Principle:
Principle #35Parameter changes

Solution Approach 2:

The system applies local quality by normalizing dynamic conditions specifically at the filter string level while maintaining the overall query plan structure. This localized normalization allows complex conditions to be handled uniformly without affecting the simplicity of the rest of the query plan, enabling effective caching

Inventive Principle:
Principle #3Local quality

Data Source

PatentUS12405953B1Caching database query plans that include dynamic conditions
Publication Date: 2025.09.02 SAP SE
  • US12405953B1 patent drawing
  • US12405953B1 patent drawing
  • US12405953B1 patent drawing

AI summary

The present disclosure involves systems, software, and computer implemented methods for managing database query plans with dynamic conditions. One example method includes receiving a request to process a query based on a dynamic condition. In response to determining that a plan cache does not include a cached query plan for the query, query plan compilation is triggered to generate a query plan. In response to determining that a cached query plan exists, for each query view, a condition provider procedure is invoked to generate a first filter string. First filter strings are compared to corresponding second filter strings in the cached plan. In response to determining that a first filter string does not match the corresponding second filter string, query plan compilation is triggered. In response to determining that each filter string matches each corresponding second filter string, the database query is executed using the cached query plan.