Hash Join Spilling to Secondary Memory for Scalability

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing data storage and retrieval systems face scalability issues due to bottlenecks in shared-disk systems and complexity in shared-nothing architectures, leading to inefficient data management and potential disruptions during node additions or removals.

Innovation Solution

The proposed solution involves a resource management system that dynamically manages data storage and retrieval by deferring the decision between broadcasting and re-partitioning joins until query execution time, using a resource manager to optimize network costs and distribute data across multiple processing nodes, thereby alleviating bottlenecks and improving scalability.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Adaptability or versatility

If data is distributed across multiple processing nodes in a shared-nothing architecture, then scalability is improved, but data rearrangement during node addition or removal becomes time-consuming and disruptive

Engineering Contradiction:
ImprovescalabilityVSAvoiddata rearrangement time
Core Design Contradiction:
Adaptability or versatilityVSLoss of time

Solution Approach 1:

The system pre-computes and stores hash values for data records during the initial data distribution phase. When nodes are added or removed, the system can quickly determine new data placements by reusing these pre-computed hash values, avoiding time-consuming data rearrangement operations. This preliminary action enables rapid adaptation to topology changes while maintaining data distribution efficiency.

Inventive Principle:
Principle #10Preliminary action

2Adaptability or versatility

If data is distributed across multiple processing nodes, then scalability is improved, but management complexity increases due to data distribution across many different processing nodes

Engineering Contradiction:
ImprovescalabilityVSAvoiddata management complexity
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The system introduces a coordination layer that uses hash-based routing to manage data distribution across nodes. This intermediary mechanism simplifies management by providing a deterministic method for data placement and retrieval, where the hash function acts as a mediator between data and nodes, eliminating the need for complex manual management of distributed data across multiple processing nodes.

Inventive Principle:
Principle #24Intermediary (Mediator)

3Speed

If hash tables are stored in memory during hash join operations, then query execution speed is improved, but memory availability for subsequent queries is reduced

Engineering Contradiction:
Improvequery execution speedVSAvoidmemory availability
Core Design Contradiction:
SpeedVSQuantity of substance

Solution Approach 1:

The system dynamically changes the state of hash tables from in-memory to persisted form based on query execution needs. After a hash join operation completes, the hash tables are persisted to storage and then freed from memory. This parameter change allows the system to achieve fast query execution when needed while recovering memory resources for subsequent queries, effectively managing the trade-off between speed and memory availability.

Inventive Principle:
Principle #35Parameter changes

4Reliability

If all data changes are written to shared storage in a shared-disk system, then data consistency is improved, but the shared storage device becomes a bottleneck that slows data read and write operations

Engineering Contradiction:
Improvedata consistencyVSAvoiddata read and write speed
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The system segments data storage and processing operations by distributing data across multiple processing nodes in a shared-nothing architecture. Each node maintains its own data subsets and can perform read and write operations independently without requiring centralized shared storage access. This segmentation eliminates the bottleneck while maintaining data consistency through coordinated data distribution and hash-based routing mechanisms.

Inventive Principle:
Principle #1Segmentation

Data Source

PatentUS11868352B2Systems and methods for spilling data for hash joins
Publication Date: 2024.01.09 SNOWFLAKE INC
  • US11868352B2 patent drawing
  • US11868352B2 patent drawing
  • US11868352B2 patent drawing

AI summary

A method includes determining that an amount of available space in a first memory used by a set of relational queries is insufficient for a query, wherein the query comprises a join operation. A first partition of a set of partitions is identified, wherein the first partition possesses a smallest available probe memory size of the set of partitions and a build memory size greater than or equal to a threshold memory size, wherein the threshold memory size is a percentage of a maximum build memory size, and the largest partition of the set of partitions has the maximum build memory size. The first partition is copied from the first memory to a second memory.