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

Towards a Converged Relational-Graph Optimization Framework

Yunkai Lou, Longbin Lai, Bingqing Lyu, Yufan Yang, Xiaoli Zhou, Wenyuan Yu, Ying Zhang, Jingren Zhou · DOI

Abstract

The recent ISO SQL:2023 standard adopts SQL/PGQ (Property Graph Queries), facilitating graph-like querying within relational databases. This advancement, however, underscores a significant gap in how to effectively optimize SQL/PGQ queries within relational database systems. To address this gap, we extend the foundational SPJ (Select-Project-Join) queries to SPJM queries, which include an additional matching operator for representing graph pattern matching in SQL/PGQ. Although SPJM queries can be converted to SPJ queries and optimized using existing relational query optimizers, our analysis shows that such a graph-agnostic method fails to benefit from graph-specific optimization techniques found in the literature. To address this issue, we develop a converged relational-graph optimization framework called RelGo for optimizing SPJM queries, leveraging joint efforts from both relational and graph query optimizations. Using DuckDB as the underlying relational execution engine, our experiments show that RelGo can generate efficient execution plans for SPJM queries. On well-established benchmarks, these plans exhibit an average speedup of 21.90x compared to those produced by the graph-agnostic optimizer.

Introduction

The database world is currently witnessing a convergence of relational and graph data models. The recent ISO SQL:2023 standard officially adopted SQL/PGQ (Property Graph Queries), allowing users to execute graph-like pattern matching directly within relational databases. However, a major "optimization gap" remains. Traditional relational optimizers are typically graph-agnostic, treating complex graph patterns as simple sequences of standard table joins. This leads to two critical failures: a massive search space explosion during optimization and suboptimal execution plans that miss out on graph-specific performance techniques like adjacency list traversals.

The SPJM Query Model

To bridge this gap, we propose extending the foundational Select-Project-Join (SPJ) query model to the SPJM model. The core of this extension is the Match (M) operator, which explicitly represents graph pattern matching within the query pipeline.

The SPJM query plan structure, integrating a Match operator with traditional relational operators.

As illustrated in Figure 1, the SPJM model allows for a seamless integration of graph matching results into the relational pipeline. The Match operator identifies subgraphs satisfying a given pattern, which are then processed by standard relational operators like Projection, Selection, and Join. This structure ensures that graph-specific constraints are preserved rather than flattened into generic joins.

The RelGo Framework

We introduce RelGo, a converged framework designed to optimize SPJM queries by combining the strengths of relational and graph optimization techniques. RelGo treats graph matching as a first-class citizen, ensuring that the optimizer "understands" the connectivity constraints of the underlying graph.

Overview of the RelGo framework, from relational data mapping to converged query execution.

As shown in Figure 2, RelGo operates by mapping relational data to a property graph and then applying a dual-optimization strategy. A dedicated graph optimizer handles the Match operator using high-order statistics, while a relational optimizer (such as Apache Calcite) manages the remaining SQL components.

Key Technical Components

  • Graph-Aware Transformation: RelGo utilizes decomposition trees to break down complex graph patterns. By restricting the optimizer to follow the graph's physical topology, the search space is reduced significantly—often leading to near-instant optimization times even for complex patterns.
  • High-Order Statistics (GLogue): Standard relational optimizers typically rely on simple table row counts. RelGo introduces GLogue, a specialized data structure for maintaining high-order statistics about sub-graph frequencies (e.g., triangles or cliques). This provides the cost model with the precision needed to select truly optimal join orders.
  • Physical Graph Indexes: To accelerate execution, RelGo implements VE-indexes (Vertex-to-Edge) and EV-indexes (Edge-to-Vertex). These allow the engine to "hop" between related entities efficiently, bypassing the overhead of traditional hash joins.
  • Heuristic Rule Integration: RelGo incorporates specialized rules like FilterIntoMatchRule, which pushes SQL WHERE clauses directly into the graph matching process to prune results as early as possible.

Experimental Evaluation

RelGo was evaluated using the LDBC SNB (Social Network Benchmark) and the JOB (Join Order Benchmark) on the DuckDB execution engine.

  • Massive Speedups: On the LDBC benchmark, RelGo-generated plans were 21.9x faster on average than those from a graph-agnostic optimizer. Even when the baseline was given the same graph indexes, RelGo was still 5.4x faster, proving the superiority of its join-ordering logic.
  • Optimization Efficiency: In some cases, RelGo was 10,000x faster at finding an optimal plan than Apache Calcite because it avoided the massive search space of traditional joins.
  • Robustness: RelGo consistently outperformed specialized systems like Umbra and graph-native databases like Kùzu on the tested hybrid workloads.

Conclusion and Future Work

RelGo demonstrates that a converged approach to relational-graph optimization is essential for the effective implementation of SQL/PGQ. By treating graph matching as a first-class citizen, RelGo overcomes the limitations of graph-agnostic optimizers. Future work will focus on incorporating attribute distribution statistics for better cardinality estimation and extending these optimizations to recursive, variable-length path queries.

Summary updated

BibTeX
@article{lou2024towards,
  author = {Yunkai Lou and Longbin Lai and Bingqing Lyu and Yufan Yang and Xiaoli Zhou and Wenyuan Yu and Ying Zhang and Jingren Zhou},
  title = {{Towards a Converged Relational-Graph Optimization Framework}},
  journal = {Proc. ACM Manag. Data},
  year = {2024},
  doi = {10.1145/3698828},
}
Figure