Old Techniques for New Join Algorithms: A Case Study in RDF Processing

Christopher R. Aberger, Susan Tu, Kunle Olukotun, Christopher Ré

Old Techniques for New Join Algorithms: A Case Study in RDF Processing

The Resource Description Framework (RDF) serves as a foundational standard for the Semantic Web, encoding data as Subject-Predicate-Object triples that form vast, interconnected graphs. Efficiently querying these graphs is a significant challenge. Traditional relational databases and specialized RDF engines typically rely on "Selinger-style" optimizers, which decompose complex joins into a sequence of pairwise operations. However, recent developments in database theory have demonstrated that for cyclic queries—such as identifying triangle patterns—any pairwise approach is asymptotically suboptimal.

While a new class of worst-case optimal join (WCOJ) algorithms has emerged to address this theoretical gap, these algorithms often lack the mature engineering optimizations that make traditional engines performant on simpler, acyclic queries. This research investigates whether integrating "classic" database optimizations into a WCOJ framework can create an engine that excels across a diverse range of RDF workloads.

Bridging the Performance Gap: The EmptyHeaded Engine

The authors utilize EmptyHeaded, a prototype engine built on WCOJ principles. EmptyHeaded represents data using tries (multi-level tree structures) and employs Generalized Hypertree Decompositions (GHDs) for query planning. The core contribution of this work is the successful mapping of three classic optimizations onto the WCOJ framework:

  1. Optimized Index Layouts: The engine dynamically selects between bitset layouts for dense data and unsigned integer arrays for sparse data. This hybrid approach enables $O(1)$ lookups in dense regions and leverages SIMD-like parallelism for set intersections.
  2. Selection Pushdown: By reordering attributes within the trie and across GHD nodes, the engine ensures that high-selectivity filters—those that discard the most data—are applied as early as possible.
  3. Pipelining: To minimize memory overhead and latency, EmptyHeaded streams data between nodes in the query plan rather than materializing massive intermediate results.
Selection pushdown through attribute reordering in a GHD tree to prioritize high-selectivity filters.

The impact of attribute reordering is particularly profound. As illustrated in the figure above, moving high-selectivity attributes (like 'a' and 'b') lower in the join tree (closer to the leaves) allows the engine to prune the search space much earlier, preventing the generation of large intermediate results that would otherwise be discarded.

Experimental Evaluation

The study evaluated EmptyHeaded using the Lehigh University Benchmark (LUBM), featuring 133 million triples. The engine was compared against a commercial WCOJ engine (LogicBlox), a traditional column-store (MonetDB), and state-of-the-art specialized RDF engines (RDF-3X and TripleBit).

The results demonstrate that while WCOJ engines are naturally superior for cyclic queries—outperforming specialized engines by up to 6x—they require the proposed optimizations to remain competitive on simpler acyclic joins.

Speedup factors achieved by incrementally adding optimizations across various LUBM queries.

As shown in the table above, the cumulative effect of these optimizations is dramatic. For instance, Query 14 saw a staggering 234x speedup purely from attribute reordering (+Attribute). Layout tuning provided up to an 8.2x improvement, while selection pushdown across GHD nodes (+GHD) yielded nearly a 70x gain in specific cases.

Key Insights and Conclusion

This case study highlights a critical lesson in database systems: asymptotic superiority (the "Big O" advantage) is insufficient if constant factors are not managed through rigorous engineering. Without classic optimizations, a theoretically "optimal" WCOJ engine can be two orders of magnitude slower than a traditional engine on simple queries.

By bridging this gap, EmptyHeaded achieves a "best of both worlds" result. It remains the fastest engine for the complex cyclic queries where traditional pairwise joins fail, while closing the performance gap on acyclic queries to within an order of magnitude of highly specialized RDF engines. Future work will focus on integrating more sophisticated cost-based optimizers to further refine join ordering and memory management.

Summary updated

BibTeX
@inproceedings{aberger2016old,
  author = {Christopher R. Aberger and Susan Tu and Kunle Olukotun and Christopher Ré},
  title = {{Old Techniques for New Join Algorithms: A Case Study in RDF Processing}},
  booktitle = {Workshops @ ICDE},
  year = {2016},
  url = {https://openreview.net/forum?id=_HVVYePXwSM},
}
Figure