Abstract
Graphical Join (GJ) is a novel physical join algorithm that treats multi-way equi-joins as an inference problem in Probabilistic Graphical Models (PGMs). By producing a compact, Run-Length Encoded (RLE) summary of the join result instead of a massive flat table, GJ achieves up to 820x speedups and reduces storage requirements by more than 78,000x compared to state-of-the-art database systems.
Introduction
Relational databases frequently struggle with "n-way" joins—queries linking multiple tables—particularly when relationships are many-to-many. Traditional systems rely on binary join plans that often generate massive "Unneeded Intermediate Results" (UIRs). While newer "Worst-Case Optimal Join Algorithms" (WOJAs) mitigate UIRs, they still produce "flat" final results. In many-to-many joins, these results are often highly redundant due to denormalization, wasting CPU, memory, and disk space, and frequently causing system crashes when result sizes explode into the billions of tuples.
Methodology
The Graphical Join (GJ) approach decomposes the join process into three primary phases:
- Mapping to PGMs: The join query is mapped to a Markov Random Field where attributes are nodes and tables are cliques.
- Learning and Inference: GJ calculates exact frequencies (potentials) by scanning input tables. It then applies a modified Variable Elimination Algorithm (VEA) on a Junction Tree to determine conditional frequencies without performing the full join.
- Summarization (GFJS): Instead of a flat table, GJ produces a Grouped Frequentist Join Summary (GFJS), a multi-column Run-Length Encoding (RLE) that stores values alongside their frequencies.
GJ is the first WOJA to support Early Projections, allowing it to prune unnecessary attributes from the graph before processing, which significantly boosts performance.
Experimental Evaluation
The authors evaluated GJ using three distinct datasets to test different join characteristics:
- JOB (Join Order Benchmark): High redundancy in many-to-many relationships.
- lastFM: Real-world user/artist links with high UIR volumes.
- TPC-H: Standard industry benchmark with Foreign Key (FK) joins, representing a "worst-case" scenario for GJ due to low redundancy.
Results and Discussion
GJ was benchmarked against PostgreSQL, MonetDB, and Umbra (a state-of-the-art system using a WOJA). Key findings include:
- Scalability: In the JOB_D query (146 billion tuples), GJ finished in 51.8 seconds using only 260MB of storage, while other systems crashed or timed out.
- Efficiency: Storage requirements were up to 78,750x smaller than Umbra. On-disk execution was up to 820x faster than PostgreSQL and 165x faster than Umbra.
- The FK Exception: For simple FK joins (TPC-H), GJ's performance was comparable to existing systems, as there was no redundancy to exploit.
The core insight of GJ is treating joins as joint probability distributions. By calculating marginals via PGM inference, the system bypasses the "explosion" of result sizes, turning I/O bottlenecks into trivial tasks.
Conclusion
While GJ currently exists as a standalone C++ library, its potential for integration into mature RDBMSs is significant. Future work includes extending the algorithm to non-equi joins and exploring massively parallel implementations on hardware like GPUs to further enhance performance.
Summary updated