Partitioned Vectorized Hash Join for Cache Containment

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Hash join operations in database systems face inefficiencies due to high latency caused by cache misses and branch mispredictions, especially when dealing with large hash tables that exceed the CPU cache, leading to suboptimal performance on modern hardware architectures.

Innovation Solution

The technique involves partitioning large tables into smaller, cache-contained subsets, allowing each partition to be fully loaded into a node's cache, using a hash bucket array and link array to efficiently generate and probe the hash table, thereby minimizing cache misses and branch mispredictions through a partition-based vectorized hash join approach.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Quantity of substance

If large hash tables are generated to handle large datasets, then the join operation can process more data, but cache misses increase leading to high latency

Engineering Contradiction:
Improvedata processing capacityVSAvoidcache miss latency
Core Design Contradiction:
Quantity of substanceVSLoss of time

Solution Approach 1:

The patent divides the large hash table into multiple smaller hash tables, each stored in different CPU caches. This segmentation allows each cache to remain small and fast, while collectively handling large datasets. The hash table is partitioned based on hash bucket ranges, with each partition fitting within a single cache memory structure.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces a partition dimension to the traditional hash table structure. Instead of a single large hash table, multiple hash tables are organized across different cache levels and CPU cores, adding a spatial distribution dimension that reduces cache miss latency while maintaining large data processing capacity.

Inventive Principle:
Principle #17Another dimension (Dimensionality change)

2Device complexity

If a single large hash table is used, then the structure is simple, but branch mispredictions increase due to complex probing patterns

Engineering Contradiction:
Improvehash table structureVSAvoidbranch misprediction penalty
Core Design Contradiction:
Device complexityVSLoss of time

Solution Approach 1:

The patent segments the hash table into multiple smaller tables, each with more predictable probing patterns. This reduces the complexity of branch prediction within each individual hash table, as each handles a subset of data with more uniform access patterns, thereby reducing branch mispredictions.

Inventive Principle:
Principle #1Segmentation

3Quantity of substance

If the hash table is stored in DRAM main-memory, then large datasets can be accommodated, but access latency increases significantly

Engineering Contradiction:
Improvehash table sizeVSAvoidhash lookup speed
Core Design Contradiction:
Quantity of substanceVSSpeed

Solution Approach 1:

The patent segments the large hash table into multiple smaller hash tables that fit within CPU caches (L1/L2 cache). This allows the hash tables to be stored in fast cache memory rather than slow DRAM, significantly improving lookup speed while collectively accommodating large datasets through distribution across multiple caches and CPU cores.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent moves the storage dimension from a single large DRAM structure to multiple distributed cache structures across different CPU cores. This dimensional change enables fast cache-based access for each partition while maintaining the ability to handle large overall dataset sizes.

Inventive Principle:
Principle #17Another dimension (Dimensionality change)

4Loss of time

If partitioning is applied to enable cache containment, then cache misses are reduced, but the system complexity increases

Engineering Contradiction:
Improvecache miss rateVSAvoidpartition management overhead
Core Design Contradiction:
Loss of timeVSDevice complexity

Solution Approach 1:

The patent implements partitioning by dividing the hash table into segments based on hash bucket ranges. Each partition is independently managed and fits within a single CPU cache, eliminating cache misses for data within each partition. The segmentation is performed automatically based on hash values, reducing manual partition management complexity.

Inventive Principle:
Principle #1Segmentation

Data Source

PatentUS10599647B2Partitioning-based vectorized hash join with compact storage footprint
Publication Date: 2020.03.24 ORACLE INT CORP
  • US10599647B2 patent drawing
  • US10599647B2 patent drawing
  • US10599647B2 patent drawing

AI summary

Techniques are described for generation of an efficient hash table for probing during join operations. A node stores a partition and generates a hash table that includes a hash bucket array and a link array, where the link array is index aligned to the partition. Each hash bucket element contains an offset that defines a location of a build key array element in the partition and a link array element in the link array. For a particular build key array element, the node determines a hash bucket element that corresponds to the build key array. If the hash bucket element contains an existing offset, the existing offset is copied to the link array element that corresponds to the offset of the particular build key array element and the offset for the particular build key array element is copied into the hash bucket element. When probing, the offset in a hash bucket element is used to locate a build key array element and other offsets stored in the link array for additional build key array elements.