Query Plan Optimization for User-Defined Functions

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current systems face challenges in optimizing the execution of user-defined functions within database operations, particularly when handling large data sets, as they treat such functions as black boxes, lacking knowledge of their pre-conditions, post-conditions, and behavior, which hinders efficient parallel processing.

Innovation Solution

The implementation of a query plan execution optimization system that utilizes annotations to specify properties of user-defined functions, allowing the optimizer to generate optimized query execution plans that account for pre-conditions, post-conditions, and behavioral properties, enabling flexible partitioning and merging strategies for improved parallel execution performance.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Adaptability or versatility

If user-defined functions are treated as black boxes without annotations, then the system maintains simplicity in handling custom functionality, but the optimizer cannot make intelligent decisions about parallelization and partitioning strategies

Engineering Contradiction:
Improveability to handle custom functionalityVSAvoidparallel execution efficiency
Core Design Contradiction:
Adaptability or versatilityVSProductivity

Solution Approach 1:

Annotations serve as an intermediary mechanism between user-defined functions and the query optimizer. These annotations provide metadata about function behavior, pre-conditions, and post-conditions without requiring the optimizer to understand the full complexity of custom functionality. This intermediary layer enables intelligent parallelization decisions while maintaining system simplicity.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Productivity

If the system implements comprehensive optimization for user-defined functions with annotations, then parallel execution efficiency improves, but the complexity of the system increases due to additional metadata requirements

Engineering Contradiction:
Improveparallel execution efficiencyVSAvoidsystem complexity
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

Annotations are prepared in advance during function definition, storing pre-conditions, post-conditions, and behavioral properties before query optimization occurs. This preliminary action allows the optimizer to make informed decisions without adding complexity during the actual query processing phase.

Inventive Principle:
Principle #10Preliminary action

3Productivity

If flexible partitioning strategies are implemented based on annotated properties, then the optimizer can generate superior execution plans, but the difficulty of detecting and measuring function properties increases

Engineering Contradiction:
Improvequery execution optimizationVSAvoiddifficulty of detecting function properties
Core Design Contradiction:
ProductivityVSDifficulty of detecting and measuring

Solution Approach 1:

The system uses self-documenting annotations that developers add to their own functions, describing pre-conditions, post-conditions, and behavioral properties. This self-service approach eliminates the need for external analysis tools to detect function properties, as the metadata is already embedded in the function definitions.

Inventive Principle:
Principle #25Self-service

Data Source

PatentEP2960813B1Optimization of parallelization of user-defined functions with flexible partitioning
Publication Date: 2019.02.13 SAP SE
  • EP2960813B1 patent drawingFigure 1
  • EP2960813B1 patent drawingFigure 2
  • EP2960813B1 patent drawingFigure 3

AI summary

Technologies are disclosed for generating query execution plans optimized for parallel execution for programs having both core database relational functions and user-defined functions. A variety of optimization strategies can be employed to improve performance in a parallel execution scenarios. A flexible range of permitted partition arrangements can be specified as acceptable to parallelized instances of the user-defined function. The optimizer can leverage such information when constructing an optimized query execution plan. Partitioning arrangements or other properties can be leveraged to avoid additional or unnecessary processing.