Abstract
In-memory spatial joins are essential for high-performance spatial data processing. This paper benchmarks six prominent algorithms—S3, SGrid, TOUCH, PBSM, Plane-Sweep, and Nested-Loop—across diverse synthetic and real-world datasets. Our results reveal that performance is highly sensitive to data distribution and join order, with execution times varying by up to 3x simply by swapping operands. We conclude that no single algorithm is universally superior, advocating for the development of adaptive spatial join engines.
Introduction
Spatial joins identify pairs of objects within a specific distance, a core operation in domains ranging from urban planning to bioinformatics. As memory capacities increase, in-memory joins have become the standard for low-latency applications. However, the interaction between algorithmic design and data characteristics remains poorly understood. This study addresses this gap by providing a comprehensive empirical evaluation of how data "messiness" impacts in-memory spatial join performance.
Methodology
We implemented six major spatial join algorithms in a unified C++ framework to ensure fair comparison: Size Separation Spatial Join (S3), Spatial Grid Hash Join (SGrid), TOUCH, Partition Based Spatial-Merge Join (PBSM), Plane-Sweep Join (PS), and Nested-Loop Join (NL). The evaluation utilized both synthetic datasets and real-world biological data representing complex structures like axons and dendrites.
Key Insights and Results
Our benchmarking reveals that join order is a critical, often overlooked performance factor. For many algorithms, swapping the order of datasets (A ⋈ B vs. B ⋈ A) causes massive performance swings. For example, SGrid's execution time varied by a factor of three when joining real data with uniform data depending on which was processed first.
TOUCH and PBSM consistently emerged as the top-performing algorithms. TOUCH is particularly effective when datasets share similar distributions, as it can build highly balanced tree structures. Conversely, PBSM is more robust when distributions are mismatched, as its grid-based partitioning is less sensitive to local density spikes.
Real-world data proved significantly more challenging than synthetic data. The irregular density of biological datasets makes it difficult for algorithms to create balanced internal structures, leading to processing bottlenecks. While Plane-Sweep and Nested-Loop were the only algorithms whose performance remained stable regardless of join order, they were generally slower than the optimized partitioning approaches.
Conclusion
This research demonstrates that in-memory spatial join performance is deeply dependent on the underlying data. The significant impact of join order and distribution suggests that the next generation of spatial databases should incorporate adaptive algorithms. Such engines would analyze data distributions at runtime to dynamically select the optimal join strategy and operand ordering, ensuring consistent high performance across diverse workloads.
Summary updated