NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

FreshJoin: An Efficient and Adaptive Algorithm for Set Containment Join

Jizhou Luo, Wei Zhang, Shengfei Shi, Hong Gao, Jianzhong Li, Wei Wu, Shouxu Jiang

Abstract

Set Containment Join (SCJ) is a critical operation in modern database systems, yet existing in-memory solutions often struggle with either high CPU overhead or excessive memory consumption. We present FreshJoin, a parameter-free and adaptive algorithm designed to bridge this gap. By replacing memory-intensive prefix trees with a frequency-aware indexing strategy and a novel adaptive hashing scheme, FreshJoin achieves significant memory reductions—often exceeding 50%—while maintaining state-of-the-art processing speeds across diverse real-world datasets.

Introduction

The Set Containment Join (SCJ) problem involves finding all pairs $(r, s)$ from two collections of sets such that $r \subseteq s$. This operation is foundational for various applications, including prerequisite checking in educational systems, profile matching in social networks, and complex data mining tasks.

Current in-memory SCJ solutions typically fall into two categories. Signature-based methods use bit-vectors to filter candidates but often incur high CPU costs due to signature enumeration. Conversely, prefix-tree-based methods offer faster filtering but require substantial RAM to store complex tree structures, creating a bottleneck as datasets scale. FreshJoin addresses these limitations by introducing a "best of both worlds" approach: a method that is both computationally fast and highly memory-efficient.

Methodology: The freshIndex and Adaptive Hashing

FreshJoin moves away from pointer-heavy prefix trees in favor of a "frequency-hash" approach that utilizes a flat, on-the-fly index called freshIndex. The core of the algorithm relies on three distinct signatures for each set:

  1. The least frequent element in the set.
  2. The second least frequent element.
  3. An adaptive hash signature (a bitmap).

The algorithm constructs a sparse asymmetric inverted index, as depicted in Figure 2. By using the two least frequent elements of sets in one relation to probe the other, FreshJoin significantly narrows the candidate space before more expensive bitwise operations are performed.

The freshIndex structure utilizes flat arrays and sparse inverted indices to minimize memory overhead while maintaining efficient lookups.

A central innovation of FreshJoin is the freHash function. Unlike standard hashing, which treats all elements uniformly, freHash partitions the element universe into low-, mid-, and high-frequency groups based on dataset statistics. Each group is mapped to a specific segment of the hash signature. This ensures that elements with different statistical properties contribute optimally to the filtering process. Furthermore, the signature length is determined adaptively based on the dataset's average set size and universe size, rendering the algorithm parameter-free.

Experimental Evaluation

The authors evaluated FreshJoin against state-of-the-art competitors using 16 real-life datasets. These datasets represent a broad spectrum of domains, including Web & Social (Twitter, LiveJournal), Transactions & Logs (BMS, AOL), Media & Reviews (Netflix, Amazon), and Software & Text (Linux, Reuters). The datasets vary significantly in average set length (from 1.78 to over 5,600) and universe size, providing a robust testbed for the algorithm's adaptability.

Key Results and Insights

FreshJoin demonstrates superior performance across several key metrics:

Memory Efficiency

FreshJoin consistently maintains the lowest memory footprint among all tested algorithms. As illustrated in Figure 6, it typically reduces space costs by more than 50% compared to LIMIT and Pretti+, and by over 70% compared to ttjoin and PTSJ on large-scale datasets. This efficiency stems from replacing complex trees with flat arrays and sparse indices, which also improves cache locality.

FreshJoin (leftmost bar) demonstrates a consistently lower memory footprint compared to state-of-the-art methods across diverse datasets.

Speed and Scalability

In terms of execution time, FreshJoin outperformed all competitors on more than half of the tested datasets and remained highly competitive on the remainder. Scalability tests confirmed that both time and memory costs grow steadily and slowly with dataset size, making it well-suited for big data applications.

Theoretical Foundation

The algorithm's effectiveness is supported by the "Power of Two" principle. Theoretical analysis suggests that indexing just the two least frequent elements is often sufficient to prune the search space dramatically, reducing the reliance on bitwise filtering.

Conclusion and Future Work

FreshJoin provides a robust, adaptive solution for the SCJ problem, particularly in memory-constrained environments. While highly effective, its advantages are somewhat diminished in "worst-case" scenarios where the universe size is very small relative to the number of sets, leading to a denser inverted index. Future research may explore automated tuning of the frequency partitioning constant ($\alpha$) to further optimize performance for specific data distributions.

Summary updated

BibTeX
@article{luo2019freshjoin,
  author = {Jizhou Luo and Wei Zhang and Shengfei Shi and Hong Gao and Jianzhong Li and Wei Wu and Shouxu Jiang},
  title = {{FreshJoin: An Efficient and Adaptive Algorithm for Set Containment Join}},
  journal = {Data Sci. Eng.},
  year = {2019},
  doi = {10.1007/s41019-019-00107-y},
}
Figure