Mapping GraphQL Queries to SQL

GraphQL (or: GQL) is a query language for APIs, offering the ability to replace inefficient request-by-request API calls by bulk-oriented request processing. GraphQL understands links between API resources and can follow such references. When these resources are held in a relational database, can a given GQL query be systematically translated into a single SQL query that traverses relationships and collects the requested resources? Can we find a translation from GQL to SQL that avoids the infamous n+1 problem when multi-valued references are traversed?


Torsten Grust