Dictionary-Encoded Hash Join Cache Optimization

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing hash join operations in database systems are inefficient due to excessive duplicate hash value calculations and key comparisons, especially when the number of unique key values is small, leading to wasteful use of computing resources.

Innovation Solution

The implementation of a dictionary-encoded hash join operation that caches hash table lookup results in an array, reducing the number of hash lookups from the number of rows per micro-partition file to the number of unique join keys per micro-partition file, thereby avoiding duplicate computations during the probe phase.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If traditional hash join operations are performed without caching, then complete hash table lookups are conducted for every row, but excessive duplicate hash value calculations and key comparisons occur, wasting computing resources

Engineering Contradiction:
Improvehash join operation efficiencyVSAvoidprocessor cycles
Core Design Contradiction:
ProductivityVSLoss of energy

Solution Approach 1:

The patent performs hash table lookups in advance during the build phase and stores results in a cache. During the probe phase, pre-computed hash values and lookup results are reused, eliminating the need to perform the same hash calculations and comparisons multiple times for duplicate keys, thus reducing processor cycles and improving efficiency

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent creates a cached copy of hash table lookup results that can be reused across multiple probe operations. Instead of repeatedly accessing the original hash table and performing identical calculations, the system uses replicated cache entries to serve subsequent lookup requests, reducing computational overhead

Inventive Principle:
Principle #26Copying

2Productivity

If hash table lookups are performed for every row in the probe phase, then all probe rows are processed, but the number of hash lookups increases unnecessarily when many rows share the same join keys

Engineering Contradiction:
Improvenumber of hash lookupsVSAvoidtime for probe phase
Core Design Contradiction:
ProductivityVSLoss of time

Solution Approach 1:

The system pre-computes hash values and performs lookup results caching before the probe phase. During probing, it checks the cache first to determine if a row's hash lookup has already been performed, avoiding redundant hash calculations and lookups for rows with duplicate join keys, thus reducing both the number of lookups and time consumed

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent implements selective caching where hash lookup results are cached based on local characteristics of the data - specifically when join keys repeat within the probe side. The cache mechanism adapts to the local data distribution pattern, providing optimization only where duplicate keys exist, rather than uniformly processing all rows

Inventive Principle:
Principle #3Local quality

3Reliability

If duplicate hash calculations and key comparisons are performed, then thorough lookup is ensured, but computing resources including memory usage and network bandwidth are wasted

Engineering Contradiction:
Improvelookup accuracyVSAvoidmemory usage
Core Design Contradiction:
ReliabilityVSQuantity of substance

Solution Approach 1:

The patent performs hash calculations and lookups in advance during the build phase, storing results in a cache before the probe phase begins. This preliminary action ensures lookup accuracy is maintained while avoiding redundant calculations during probing, as the pre-computed results are stored in memory for efficient retrieval without re-calculation

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The system creates cached copies of hash table entries and lookup results that can be reused during the probe phase. These copies are stored in memory with appropriate data structures that maintain lookup accuracy while reducing the need for repeated access to the original hash table, thus optimizing memory usage patterns

Inventive Principle:
Principle #26Copying

Data Source

PatentUS11403294B1Smart scan hash join optimization
Publication Date: 2022.08.02 SNOWFLAKE INC
  • US11403294B1 patent drawing
  • US11403294B1 patent drawing
  • US11403294B1 patent drawing

AI summary

In one aspect, a computer-implemented method includes detecting, by a server includes one or more processors, a request to perform a hash join operation on a data structure stored in a data storage device, forming a hash lookup dictionary based on lookup results in a hash table, storing the hash lookup dictionary in a cache, and probing, during a probing phase of the hash join operation, the cache.