# Introducing PathQuery, Google's Graph Query Language

DevFeed: [Introducing PathQuery, Google's Graph Query Language](<https://devfeed.tech/articles/introducing-pathquery-google-s-graph-query-language-29479.md>)

Original publisher: [Read original article](<http://lambda-the-ultimate.org/introducing-google-path-query>)

Published: 2021-06-30T13:23:37Z

Content type: article

Language: en

Sources: [Lambda the Ultimate](<https://devfeed.tech/sources/lambda-the-ultimate.md>)

Topics: [Graphs](<https://devfeed.tech/topics/graphs.md>), [Query (disambiguation)](<https://devfeed.tech/topics/query.md>), [Google](<https://devfeed.tech/topics/google.md>), [data](<https://devfeed.tech/topics/data.md>), [Code](<https://devfeed.tech/topics/code.md>), [Latency](<https://devfeed.tech/topics/latency.md>), [Optimization](<https://devfeed.tech/topics/optimization.md>), [modules](<https://devfeed.tech/topics/modules.md>), [Object-relational mapping](<https://devfeed.tech/topics/orm.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [data](<https://devfeed.tech/tags/data.md>), [declarative](<https://devfeed.tech/tags/declarative.md>), [dsl](<https://devfeed.tech/tags/dsl.md>), [google](<https://devfeed.tech/tags/google.md>), [graph](<https://devfeed.tech/tags/graph.md>), [latency](<https://devfeed.tech/tags/latency.md>), [mapping](<https://devfeed.tech/tags/mapping.md>), [module](<https://devfeed.tech/tags/module.md>), [optimization](<https://devfeed.tech/tags/optimization.md>), [semantics](<https://devfeed.tech/tags/semantics.md>)

## AI overview

The article introduces PathQuery, a graph query language developed at Google to handle large query and data volumes and support its internal developer community. It describes declarative graph-traversal syntax, a foundation in a custom relational algebra variant, optimization opportunities, and a module and compilation system for reuse across projects.

## Source excerpt

Introducing PathQuery, Google's Graph Query Language We introduce PathQuery, a graph query language developed to scale with Google's query and data volumes as well as its internal developer community. PathQuery supports flexible and declarative semantics. We have found that this enables query developers to think in a naturally "graphy" design space and to avoid the additional cognitive effort of coordinating numerous joins and subqueries often required to express an equivalent query in a relational space. Despite its traversal-oriented syntactic style, PathQuery has a foundation on a custom variant of relational algebra -- the exposition of which we presently defer -- allowing for the application of both common and novel optimizations. We believe that PathQuery has withstood a "test of time" at Google, under both large scale and low latency requirements. We thus share herein a language design that admits a rigorous declarative semantics, has scaled well in practice, and provides a natural syntax for graph traversals while also admitting complex graph patterns. Things that are somewhat interesting to me, from an engineering standpoint: 1. PathQuery has a module/compilation system, enabling re-use of PathQuery modules across projects. (Someone had mentioned that Google has around 40,000 PathQuery modules already, internally...) 2. PathQuery supports native functions so that some query pieces can be evaluated procedurally (peephole optimization) 3. Use of relational algebra to enable a lot of known optimizations, plus future optimizations Also, from a socio-linguistic perspective, Graph Languages are effectively the new Object-Relational Mapping layer, but they solve an interesting organizational problem of allowing multiple teams to code in different languages, without needing to re-write / re-implement entities and mapping configurations in each language. It's the Old New Thing again...