Spatial Joins Using R-trees: Breadth-First Traversal with Global Optimizations

Yun-Wu Huang, Ning Jing, Elke A. Rundensteiner

Abstract

Spatial joins are critical operations in geographic information systems, yet they remain computationally intensive. Traditional depth-first traversal methods for R-tree joins often suffer from redundant I/O due to a lack of global visibility. This paper presents the Breadth-First R-tree Join (BFRJ), which processes tree levels synchronously. By constructing Intermediate Join Indexes (IJI) at each level, BFRJ enables global optimizations in node-pair ordering and buffer management. Experimental results using US Census TIGER/Line data demonstrate that BFRJ can reduce execution time by up to 50% compared to state-of-the-art depth-first approaches.

Introduction

Spatial joins—queries such as "find all lakes that intersect with a forest"—are fundamental to Geographic Information Systems (GIS) and CAD/CAM. These operations are notoriously expensive in terms of both CPU and I/O because they involve comparing massive datasets of complex geometric shapes. Most spatial databases utilize R-trees to organize objects into a hierarchy of Minimum Bounding Rectangles (MBRs).

The standard approach to joining two R-trees has historically been a depth-first traversal (DFRJ). While efficient in some contexts, DFRJ possesses a "local" perspective, exploring sub-trees in isolation. This local view makes it difficult to optimize the order of disk page accesses, frequently leading to redundant I/O when the system buffer is small.

The Breadth-First R-tree Join (BFRJ)

To overcome the limitations of local traversal, we propose the Breadth-First R-tree Join (BFRJ). Unlike the traditional approach, BFRJ processes the trees level-by-level in a synchronous fashion.

Figure 1: Illustration of the BFRJ process showing synchronous level-by-level traversal and the generation of Intermediate Join Indexes (IJIs).

As shown in Figure 1, the algorithm begins by joining the root nodes. At each level, it produces an Intermediate Join Index (IJI)—a comprehensive list of all overlapping node pairs from the two trees that must be joined at the subsequent level. This IJI provides a "global view" of the upcoming workload, transforming the algorithm from a blind explorer into a smart scheduler.

Global Optimizations

The global visibility afforded by the IJI allows for two primary optimizations:

  1. IJI Ordering: By sorting the pairs in the IJI before processing the next level, the system can maximize spatial locality. Strategies include OrdSum (sorting by the sum of MBR center coordinates) and OrdOne (sorting by one tree's coordinates). This ensures that once a node is loaded into memory, all its required joins are performed before it is evicted.
  2. Predictive Buffering: The system pre-calculates a "reference count" for each node based on the IJI. This allows for a deterministic pinning/purging strategy: a node is "pinned" in memory until its final join is complete and then immediately "purged" to free space, outperforming generic LRU (Least Recently Used) logic.

Experimental Evaluation

We evaluated BFRJ using real-world GIS data from the US Census Bureau TIGER/Line files, specifically comparing street datasets (131,461 objects) with rivers and railway tracts (128,971 objects). The data was indexed using Hilbert curve-packed R-trees with 4 KB page sizes.

Figure 2: Total I/O pages vs. Buffer Size for various ordering strategies. BFRJ strategies consistently approach the theoretical optimal baseline.

As illustrated in Figure 2, I/O is the primary bottleneck in spatial joins. BFRJ with global optimizations consistently outperformed the state-of-the-art depth-first approach, achieving up to a 50% reduction in total execution time. The experiments demonstrated that while OrdSum is highly effective for larger buffers, OrdOne provides superior performance in memory-constrained environments by maximizing storage locality.

Conclusion

The shift from depth-first to breadth-first traversal represents a fundamental change in how spatial joins are managed. By providing a global view of the join workload, BFRJ enables sophisticated scheduling and buffer management that significantly reduces redundant I/O. Our results confirm that BFRJ is a robust, scalable solution for high-performance spatial query processing.

Summary updated

BibTeX
@inproceedings{huang1997spatial,
  author = {Yun-Wu Huang and Ning Jing and Elke A. Rundensteiner},
  title = {{Spatial Joins Using R-trees: Breadth-First Traversal with Global Optimizations}},
  booktitle = {VLDB},
  year = {1997},
}
Figure