[Paper Review] GQL and SQL/PGQ: Theoretical Models and Expressive Power
This paper introduces Core GQL and Core PGQ—minimal, formal models of the recent GQL and SQL/PGQ standards—to analyze their expressive power. It demonstrates that despite supporting reachability and first-order logic, these languages cannot express basic queries like path value monotonicity, and are less expressive than recursive SQL or linear Datalog, revealing critical design gaps that must be addressed in future standard extensions.
SQL/PGQ and GQL are very recent international standards for querying property graphs: SQL/PGQ specifies how to query relational representations of property graphs in SQL, while GQL is a standalone language for graph databases. The rapid industrial development of these standards left the academic community trailing in its wake. While digests of the languages have appeared, we do not yet have concise foundational models like relational algebra and calculus for relational databases that enable the formal study of languages, including their expressiveness and limitations. At the same time, work on the next versions of the standards has already begun, to address the perceived limitations of their first versions. Motivated by this, we initiate a formal study of SQL/PGQ and GQL, concentrating on their concise formal model and expressiveness. For the former, we define simple core languages -- Core GQL and Core PGQ -- that capture the essence of the new standards, are amenable to theoretical analysis, and fully clarify the difference between PGQ's bottom up evaluation versus GQL's linear, or pipelined approach. Equipped with these models, we both confirm the necessity to extend the language to fill in the expressiveness gaps and identify the source of these deficiencies. We complement our theoretical analysis with an experimental study, demonstrating that existing workarounds in full GQL and PGQ are impractical which further underscores the necessity to correct deficiencies in the language design.
Motivation & Objective
- To provide concise, formal models—Core GQL and Core PGQ—that capture the essential semantics of the newly standardized GQL and SQL/PGQ languages.
- To investigate the expressive power of these models and identify fundamental limitations that hinder practical query expressiveness.
- To compare GQL and PGQ with recursive SQL and linear Datalog, revealing that the former are strictly less expressive despite supporting reachability.
- To identify missing compositional features in current graph query languages, particularly the lack of two-way interoperability between pattern matching and relational operations.
- To guide future standardization efforts by pinpointing specific language constructs that must be added to close expressive gaps.
Proposed method
- Define Core GQL and Core PGQ as minimal, formal languages based on pattern matching and relational algebra, abstracting away SQL-specific features like bags, nulls, and aggregates.
- Model GQL as a linear, pipelined composition of operators on the result table of pattern matching, contrasting it with PGQ’s bottom-up evaluation in a relational context.
- Use complexity-theoretic analysis to compare expressive power, showing that Core GQL and PGQ are complete for NLogSpace but cannot express certain NLogSpace queries expressible in recursive SQL.
- Formalize the lack of compositionality by demonstrating that relational outputs cannot be converted back into graphs for further pattern matching, blocking the expression of queries requiring nested or recursive graph operations.
- Use subqueries and graph-to-relational transformations to show that even basic queries—like checking increasing edge values along a path—cannot be expressed without language extensions.
- Compare the expressive power of Core GQL/PGQ with linear Datalog and recursive SQL, proving that the former fall short despite having reachability and first-order logic.

Experimental results
Research questions
- RQ1Can Core GQL and Core PGQ express all queries that are in NLogSpace, including those requiring monotonicity checks along paths?
- RQ2Why are certain NLogSpace queries, such as those involving increasing edge values along paths, not expressible in Core GQL and PGQ despite their support for reachability and first-order logic?
- RQ3How does the expressive power of GQL and PGQ compare to that of recursive SQL and linear Datalog, given their shared foundation in pattern matching and relational operations?
- RQ4What are the key missing features in GQL and PGQ that prevent them from achieving full compositionality between pattern matching and relational querying?
- RQ5What specific language constructs are needed to close the expressive gaps identified in Core GQL and PGQ, particularly for queries involving nested or recursive graph operations?
Key findings
- Core GQL and Core PGQ cannot express the query that checks whether edge values strictly increase along a path, despite being able to express reachability and first-order logic.
- The languages are complete for NLogSpace but cannot express some NLogSpace queries that are expressible in recursive SQL and linear Datalog, indicating a fundamental expressive deficiency.
- The lack of two-way interoperability between pattern matching and relational operations prevents the reuse of relational outputs as graphs, blocking compositionality and limiting expressiveness.
- Even basic queries requiring subqueries over graph outputs—such as verifying the non-existence of a violating path—cannot be expressed without extending the language.
- The failure to express such queries is not due to complexity but due to structural limitations in the language design, particularly the absence of graph-returning operations from relational results.
- The results justify the need for future standard extensions to include constructs that allow relational outputs to be interpreted as graphs, enabling recursive and compositional query patterns.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.