Transforming User-Defined Table Functions to Derived Tables

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Database management systems face inefficiencies when processing user-defined table functions (UDTFs) due to the need to access external code libraries, which increases resource usage and impacts query processing performance.

Innovation Solution

Transforming UDTFs into derived tables within the database query, allowing for inlining or lateral correlation, thereby avoiding external code library calls and enabling optimization of the query and derived table as a whole.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Adaptability or versatility

If UDTF is used in database query, then query functionality is extended, but resource usage increases and query processing performance deteriorates

Engineering Contradiction:
Improvequery functionalityVSAvoidquery processing performance
Core Design Contradiction:
Adaptability or versatilityVSProductivity

Solution Approach 1:

The patent merges the UDTF logic with the main query by inlining the SQL statements from the UDTF directly into the query plan. This integration eliminates the need for separate function execution, allowing the database optimizer to treat the entire query as a unified unit and apply optimizations across the complete query logic, thereby improving performance while preserving functionality.

Inventive Principle:
Principle #5Merging (Combining)

Solution Approach 2:

The patent extracts the SQL statements from the external UDTF code library and incorporates them directly into the database query. By taking out the function logic from its external container and embedding it within the query itself, the system eliminates overhead associated with external code execution while maintaining the extended query capabilities.

Inventive Principle:
Principle #2Taking out (Extraction)

2Adaptability or versatility

If UDTF is used in database query, then query functionality is extended, but resource usage increases

Engineering Contradiction:
Improvequery functionalityVSAvoidresource usage
Core Design Contradiction:
Adaptability or versatilityVSUse of energy by moving object

Solution Approach 1:

The patent combines the UDTF execution with the main query execution by inlining the function logic. This merging eliminates redundant resource consumption associated with separate function invocation, such as memory allocation for external code execution and repeated parsing of function definitions, thereby reducing overall resource usage while preserving query functionality.

Inventive Principle:
Principle #5Merging (Combining)

Solution Approach 2:

The patent extracts the SQL statements from the external UDTF code library and embeds them directly in the query. This extraction eliminates the need to load and execute external code, reducing memory usage and CPU cycles spent on function invocation overhead, thus lowering resource consumption while maintaining extended query capabilities.

Inventive Principle:
Principle #2Taking out (Extraction)

3Productivity

If UDTF is inlined as derived table, then external code library calls are avoided, but query complexity increases

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

Solution Approach 1:

The patent introduces a derived table as an intermediary structure to represent the inlined UDTF logic. This derived table acts as a mediator that encapsulates the extracted SQL statements, allowing the query optimizer to work with a structured representation of the query logic while simplifying the overall query plan generation and execution.

Inventive Principle:
Principle #24Intermediary (Mediator)

Data Source

PatentUS11354313B2Transforming a user-defined table function to a derived table in a database management system
Publication Date: 2022.06.07 ALIBABA GROUP HOLDING LTD
  • US11354313B2 patent drawing
  • US11354313B2 patent drawing
  • US11354313B2 patent drawing

AI summary

Disclosed aspects relate to transforming a user-defined table function (UDTF) to a derived table in a database management system (DBMS). It may be detected by the DBMS that a query indicates the UDTF. A derived table may be constructed from the UDTF. The derived table may be derived from a set of statements of the UDTF. The derived table may be introduced to the query to fulfill the UDTF. A query plan may be generated for the query by the DBMS. The query plan may be generated in response to introducing the derived table in the query.