Hash-Based Group-By for Efficient SQL Set Operations

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing SQL SET operation methods are resource-intensive and inefficient, particularly when dealing with large data sets, as they often require multiple phases of sorting and comparison, which can lead to high CPU and memory usage.

Innovation Solution

Implementing a single hash-based group-by operation that generates a hash table from one data set and probes the second data set against it, using markers and count values to determine which rows to keep or remove, thereby reducing resource consumption and improving execution speed.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Ease of operation

If multiple phases of sorting and comparison are used to evaluate SET operations, then the operations can be performed with simple and straightforward logic, but CPU and memory usage increase significantly

Engineering Contradiction:
Improvesimplicity of set operation evaluationVSAvoidCPU and memory usage
Core Design Contradiction:
Ease of operationVSUse of energy by moving object

Solution Approach 1:

The patent merges multiple phases of sorting and comparison into a single hash-based group-by operation. Instead of performing unique operations on each dataset separately followed by combine operations, the system combines both phases into one unified hash table construction process, reducing overall resource consumption while maintaining operational simplicity

Inventive Principle:
Principle #5Merging (Combining)

Solution Approach 2:

The patent replaces the mechanical sorting and comparison process with a hash-based approach. The hash function distributes records into buckets, eliminating the need for traditional sorting algorithms and reducing the computational complexity from O(n log n) to O(n) average case, thereby reducing CPU and memory usage

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

2Use of energy by moving object

If a join operation is performed followed by unique operation, then resource consumption may be reduced when result set is small, but resource usage increases when join produces large data set

Engineering Contradiction:
Improveresource consumptionVSAvoidsize of intermediate result set
Core Design Contradiction:
Use of energy by moving objectVSQuantity of substance

Solution Approach 1:

The patent performs preliminary hashing and grouping of records from both datasets before any join operation. By pre-computing hash values and organizing records into buckets based on their keys, the system prepares data structures that enable efficient set operations without generating large intermediate result sets, thus reducing resource consumption regardless of dataset size

Inventive Principle:
Principle #10Preliminary action

3Ease of operation

If traditional unique and combine operators are used, then set operations can be evaluated with straightforward logic, but processing time increases due to multiple resource-intensive steps

Engineering Contradiction:
Improvestraightforward evaluation logicVSAvoidexecution speed
Core Design Contradiction:
Ease of operationVSProductivity

Solution Approach 1:

The patent implements continuous hashing and grouping operations that process records from both datasets simultaneously in a single pass. Instead of sequential processing through multiple distinct phases (unique on t1, unique on t2, then combine), the system continuously builds hash tables and determines set operation results in one unified operation, maintaining logical simplicity while significantly improving execution speed

Inventive Principle:
Principle #20Continuity of useful action

Data Source

PatentUS9535956B2Efficient set operation execution using a single group-by operation
Publication Date: 2017.01.03 ORACLE INT CORP
  • US9535956B2 patent drawing
  • US9535956B2 patent drawing
  • US9535956B2 patent drawing

AI summary

Techniques are described herein for efficient set operation execution. According to some embodiments, a request is received to perform a set operation with respect to a first data set and a second data set. The request may identify the first data set, the second data set, and a type of set operation to perform. In response to receiving the request, a hash table is generated in memory from a first set of records in the first data set, and a second set of records from the second data set is probed against the hash table. Based on probing the hash table and the type of set operation identified in the request, records that satisfy the set operation are identified and output from the hash table.