Towards Cross-Model Efficiency in SQL/PGQ
Hadar Rotschield, Liat Peterfreund
TL;DR
This work investigates how SQL/PGQ, which blends relational and graph querying, affects performance when queries are written as SQL or graph patterns. Through cross-system experiments on DuckDB with DuckPGQ, Google Cloud Spanner, and Neo4j, it shows that execution efficiency hinges on internal optimizations and plans rather than mere syntax, with some systems favoring SQL/PGQ and others favoring SQL. The authors argue for holistic optimization that decouples language form from execution, proposing internal rewriting and cross-model algorithm integration as two promising directions. The findings highlight the potential and challenges of unified optimization for hybrid graph-relational workloads in real-world DBMSs.
Abstract
SQL/PGQ is a new standard that integrates graph querying into relational systems, allowing users to freely switch between graph patterns and SQL. Our experiments show performance gaps between these models, as queries written in both formalisms can exhibit varying performance depending on the formalism used, suggesting that current approaches handle each query type separately, applying distinct optimizations to each formalism. We argue that a holistic optimization is necessary, where the system internally decides on the best algorithms regardless of whether queries are written in SQL or as graph patterns. We propose possible future research direction to unify these optimizations and mitigate performance gaps.
