A GraphQL query is just a query on some objects having some fields. You can tie any function to a field. In particular, you can have each field be a function which executes SQL code. And that code is free to JOIN as it wants.
Squint your eyes some more: how do you do it in a RESTful interface? It is the same idea.
GraphQL really excels, however, in that it is not tied to SQL. You can have part of the query be from one source, and other parts be from other sources.
- Ruby implementation can dig into Active Record to perform batching of the queries, that normally would be executed in parallel.
- JavaScript implementation may use DataLoader library to support the same batching behavior for basically any async (promise-based) operation. See this presentation, it shows how the issue look like and how Data Loader helps to solve it: https://www.youtube.com/watch?v=c35bj1AT3X8&t=15m42s
- Python and Elixir implementations can make use of information about query subsegments, so you can prefetch necessary data.
- F# implementation works in similar way to Elixir but it's not limited to analyse GraphQL query fragments, but can also perform live analysis of the user-defined resolve functions code to determine a tree of used F# objects and properties instead. This allow to diverge GraphQL domain model from the underlying database model.
- A lot of other libraries are dedicated to particular database or query language and map GraphQL schema directly onto database model, so GQL query is translated directly into underlying database query model (including joins).
So asking how to do a join in GraphQL is like asking how to do a join in REST. It's not a well-formed question.
The good news is that the sever can expose absolutely anything as a GraphQL query. They're just arbitrary entry-points into the schema. Think of it as like calling a stored procedure. The procedure is an opaque thing as far as the caller is concerned.
PS: My comment does not mean the reference implementation is bad, it's just that it's a reference and good in a lot of cases but not in all. It does not mean you have to use every part of it, you can write your own execution module.
Literally almost every app I ever write, even the simple ones, offload tons of work to the database for joins between a half dozen tables.
I have yet to see a sane answer on how this is possible with GraphQL? How am I supposed to think about performance ... and not just having something overly simple/basic like HERES MAH BLOG... HERES DA COMMENTS!!!!!!