Hash Join Partitioning for Memory-Constrained Database Systems

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Hash join processes in databases often run out of memory, leading to degraded performance as they are forced to store data structures on disk, requiring significant resource analysis and consumption by development and support teams.

Innovation Solution

Implementing a hash join method that builds a hash table with a limited memory constraint, where partitions are spilled to persistent storage when memory is exceeded, allowing new rows to be added by reusing memory space, and determining the initial number of partitions based on the memory limit to optimize performance.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If hash table size is increased to store more rows in memory, then query performance is improved, but memory consumption exceeds available memory limit

Engineering Contradiction:
Improvequery performanceVSAvoidmemory consumption
Core Design Contradiction:
ProductivityVSQuantity of substance

Solution Approach 1:

The hash table is divided into multiple partitions, each of which can be independently managed and spilled to disk. This segmentation allows the system to control memory usage by spilling only the necessary partitions when memory is full, while keeping other partitions in memory for fast access.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The system dynamically adjusts the number of partitions based on available memory. When memory is full, it spills partitions to disk and adjusts the partition count to fit within memory constraints, thereby adapting the hash table parameters to available resources.

Inventive Principle:
Principle #35Parameter changes

2Quantity of substance

If partitions are spilled to disk when memory is exceeded, then memory constraint is satisfied, but disk access increases causing performance degradation

Engineering Contradiction:
Improvememory usageVSAvoiddisk access time
Core Design Contradiction:
Quantity of substanceVSLoss of time

Solution Approach 1:

The system pre-calculates the optimal number of partitions based on available memory before building the hash table. This preliminary action ensures that the hash table is initially configured to fit in memory, avoiding the need for spilling and the associated performance degradation.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The system dynamically adjusts the number of partitions during the hash table construction process. If memory is full, it spills partitions to disk and adjusts the partition count downward, allowing the system to adapt to memory constraints while minimizing disk access.

Inventive Principle:
Principle #15Dynamics

3Productivity

If number of partitions is increased to reduce spilling, then memory utilization is improved, but system complexity increases

Engineering Contradiction:
Improvememory utilizationVSAvoidsystem complexity
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The system automatically determines the optimal number of partitions based on available memory and data characteristics, without requiring manual configuration. This self-service approach simplifies system complexity while maintaining high memory utilization.

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The system monitors memory usage during hash table construction and provides feedback to adjust the number of partitions dynamically. This feedback mechanism ensures optimal memory utilization while avoiding excessive complexity by adjusting partitions based on actual memory conditions.

Inventive Principle:
Principle #23Feedback

Data Source

PatentUS9275110B2Disk-based hash join process
Publication Date: 2016.03.01 PARACCEL INC
  • US9275110B2 patent drawing
  • US9275110B2 patent drawing
  • US9275110B2 patent drawing

AI summary

A database system performs hash join process for processing queries that join an inner and an outer database table. The hash join processes builds a hash table in memory for the inner table. The database system receives a limit on the memory for storing the hash table. The database system maximizes the number of partitions stored in memory for the hash table. If the hash table exceeds the limit of the memory while adding rows from the inner table, the database system selects a partition for spilling to a persistent storage. The partition selected for spilling to may be the largest partition or a partition larger than most of the partitions. The database system initializes the hash table to a number of partitions that is substantially equal to half of the total number of blocks that can be stored within the specified limit of memory for the hash table.