Multi-Agent Join

Vahid Ghadakchi, Mian Xie, Arash Termehchy, Bakhtiyar Doskenov, Bharghav Srikhakollu, Summit Haque, Huazheng WangarXiv 2023

Abstract

It is crucial to provide real-time performance in many applications, such as interactive and exploratory data analysis. In these settings, users often need to view subsets of query results quickly. It is challenging to deliver such results over large datasets for relational operators over multiple relations, such as join. Join algorithms usually spend a long time on scanning and attempting to join parts of relations that may not generate any result. Current solutions usually require lengthy and repeated preprocessing, which is costly and may not be possible to do in many settings. Also, they often support restricted types of joins. In this paper, we outline a novel approach for achieving efficient join processing in which a scan operator of the join learns during query execution, the portions of its relations that might satisfy the join predicate. We further improve this method using an algorithm in which both scan operators collaboratively learn an efficient join execution strategy. We also show that this approach generalizes traditional and non-learning methods for joining. Our extensive empirical studies using standard benchmarks indicate that this approach outperforms similar methods considerably.

Introduction

In modern data analysis, users increasingly require real-time feedback from massive datasets to support interactive exploration. However, traditional join algorithms—the backbone of relational databases—often struggle to meet these latency requirements. Standard approaches like Nested Loop Joins are essentially "blind"; they spend significant computational resources scanning "cold" data regions that yield few or no results.

Existing attempts to mitigate this latency typically rely on extensive preprocessing, such as building indexes or sorting data. These methods are often impractical for ad-hoc queries, evolving datasets, or environments where storage overhead is a concern. While Approximate Query Processing (AQP) methods like Ripple Join offer progressive results, they frequently suffer from memory limitations or restricted join type support. This paper introduces a "Multi-Agent Join" framework that treats database scan operators as intelligent agents capable of learning which data segments are most productive during query execution.

The Multi-Agent Learning Framework

The core innovation of this research is the modeling of join operations as a Multi-Armed Bandit (MAB) problem. By treating scan operators as agents, the system can dynamically optimize its execution strategy based on observed rewards.

Scan Operators as Agents

In this framework, each table in a join is managed by a scan operator acting as an agent. The agent's "action" involves selecting a specific block of data to read next, while its "reward" is defined by the number of successful join results produced by those tuples.

Online Sequential Learning (OSL)

Standard MAB algorithms assume infinite rewards, but database joins involve "finite rewards"—once a tuple has been joined with all potential matches in the opposing table, it is exhausted. To address this, the authors developed Online Sequential Learning (OSL), an adaptation of the Upper Confidence Bound (UCB) algorithm. OSL utilizes "super-rounds" that balance exploration (sampling data to estimate potential rewards) and exploitation (fully joining the most promising data blocks).

To estimate rewards efficiently without exhaustive scanning, the system employs an $N$-Failure technique. The agent attempts to join a tuple with random samples from the target table until it encounters $N$ consecutive failures. This provides a statistically sound proxy for the tuple's "richness" or reward potential.

Collaborative Learning (ICL & CL)

The framework further evolves through Implicit Collaborative Learning (ICL). In this mode, one agent leverages the "failed" join attempts of its counterpart to update its own internal model of data distribution. This collaborative approach allows the system to learn about the characteristics of Table B while it is actively processing Table A, effectively making the learning process "free" in terms of additional disk I/O.

Statistical Estimation and ROSL

For scenarios requiring aggregate functions (such as COUNT or SUM) with provable confidence intervals, the authors propose Randomized OSL (ROSL). This variation incorporates randomized selection to ensure every tuple maintains a non-zero probability of being selected. This allows for unbiased statistical estimation, enabling the system to provide highly accurate approximations of final results long before the full join is completed.

Experimental Evaluation

The framework was evaluated using the industry-standard TPC-H benchmark on a 50 GB database, with a focus on varying levels of data skew using Zipfian distributions ($z$ values from 0 to 1.5). Skew is a critical factor; when data is uniform, there is little to "learn," but as skew increases, the value of identifying "hot" tuples grows exponentially.

Key Findings

  • Performance Gains: OSL significantly outperformed standard Nested Loop (NL) and Block Nested Loop (BNL) joins. The performance advantage scaled directly with the degree of data skew.
  • Memory Efficiency: OSL demonstrated remarkable resilience to memory constraints, outperforming Sort-Merge-Shrink (SMS) joins even when OSL was allocated only 0.5 GB of memory compared to 4 GB for SMS.
  • AQP Accuracy: Using ROSL, the system achieved 90% accuracy for COUNT queries after sampling only 0.001% of the total results (approximately 1,000 samples out of 75 million).
  • Complex Predicates: Because the agents learn from results rather than query logic, the framework excels at "black-box" predicates, such as similarity joins (e.g., Levenshtein distance). In tests where traditional indexes failed, the learning-based methods were the only ones to return results within a 15-minute timeout on highly skewed data.

Conclusion and Future Work

The Multi-Agent Join framework represents a shift from static query planning to dynamic, learning-based execution. By identifying and prioritizing high-reward data regions in real-time, the system delivers partial results significantly faster than traditional methods without the need for costly preprocessing.

While the overhead of learning provides minimal benefit in perfectly uniform datasets, the authors demonstrated that OSL remains competitive with standard methods even in worst-case scenarios. Future research directions include integrating these learning scan operators directly into query optimizers and extending the framework to support multi-table joins beyond binary operations.

Summary updated

BibTeX
@misc{ghadakchi2023multi,
  author = {Vahid Ghadakchi and Mian Xie and Arash Termehchy and Bakhtiyar Doskenov and Bharghav Srikhakollu and Summit Haque and Huazheng Wang},
  title = {{Multi-Agent Join}},
  year = {2023},
  eprint = {2312.14291},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2312.14291},
}
Figure