Subquery Domain Constraints for Smaller Intermediate Result Sets

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Relational database systems face inefficiencies in query execution due to the generation of large intermediate result sets, especially when only a small subset is needed for further processing, leading to increased memory and processor usage.

Innovation Solution

The database engine incorporates a domain constraint optimizer that inserts domain constraints into subqueries based on estimated cardinality and filter conditions, reducing unnecessary row retrieval by using early-probe operators and hash tables to filter out superfluous data early in the operator tree.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If the database engine executes subqueries without domain constraints, then complete intermediate result sets are generated, but memory usage and processing time increase significantly

Engineering Contradiction:
Improvequery processing speedVSAvoidintermediate result set size
Core Design Contradiction:
ProductivityVSQuantity of substance

Solution Approach 1:

The optimizer performs preliminary analysis of the query plan to identify domain constraints from outer queries before executing the subquery. By pushing these constraints down into the subquery execution, the system preliminarily filters the data scope, reducing the intermediate result set size before it grows large

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The optimizer extracts unnecessary data from the intermediate result set by applying domain constraints that identify and remove rows that will not be needed for the final query result. This extraction happens early in the execution plan, preventing wasted processing on irrelevant data

Inventive Principle:
Principle #2Taking out (Extraction)

2Reliability

If the database engine retrieves all rows from subqueries, then data completeness is ensured, but memory consumption increases

Engineering Contradiction:
Improvedata completenessVSAvoidmemory usage
Core Design Contradiction:
ReliabilityVSUse of energy by moving object

Solution Approach 1:

The system performs preliminary identification of domain constraints from outer queries and pushes them into the subquery execution plan. This preliminary action ensures that only relevant rows are retrieved, maintaining data completeness for the final result while reducing memory consumption by excluding unnecessary rows from the outset

Inventive Principle:
Principle #10Preliminary action

3Quantity of substance

If domain constraints are inserted into subqueries, then intermediate result set size is reduced, but query plan complexity increases

Engineering Contradiction:
Improveintermediate result set sizeVSAvoidquery execution plan complexity
Core Design Contradiction:
Quantity of substanceVSDevice complexity

Solution Approach 1:

The query optimizer automatically performs the analysis and transformation of pushing domain constraints into subqueries without requiring manual intervention. The system self-services by identifying optimization opportunities and applying the necessary plan modifications, making the complexity management transparent to the user while still achieving reduced intermediate result sets

Inventive Principle:
Principle #25Self-service

Data Source

PatentUS10642832B1Reducing the domain of a subquery by retrieving constraints from the outer query
Publication Date: 2020.05.05 TABLEAU SOFTWARE INC
  • US10642832B1 patent drawing
  • US10642832B1 patent drawing
  • US10642832B1 patent drawing

AI summary

A database engine receives a human-readable database query that includes a subquery, and parses the database query to build an operator tree. The operator tree includes a subtree corresponding to the subquery. The database engine estimates the number of rows that will accessed when the subtree is executed and estimates the fraction of the cardinality of rows that will be filtered out by subsequent operations in the operator tree. In accordance with a determination that the estimated fraction exceeds a first threshold, the database engine inserts a domain constraint into the subtree that restricts rows retrieved by execution of the subtree, thereby forming a modified operator tree. The database engine executes the modified operator tree to form a final result set corresponding to the database query and returns the final result set.