Update:
This is a repost from an internal discussion with some good info on DQL anatomy. Dear reader, don’t be confused with some parallel comment. There were a lot of comments in the original post that I choose to leave out of this.
Facets
Facets are extra information that you can add to an edge. It is often used for metadata or to reduce CPU usage as Facets are not indexed. As facets are not first-class citizens, they cannot be queried directly. You need to query Node and then apply the functions to Facets. In the same query.
A “Summary”
Here we have the summary of all keywords used in queries.
Query Anatomy
This one was the first.
Above we have an example of Query using practically all DQL functions and directives. Except Facets and Fragments.
Showing all Root query parameters.
Var Block
Var blocks are blocks that are not shown in the query. It’s generally used to do complex queries, math, and other things that don’t need to be seen in the response.
Two Blocks
In DQL you can have a cascade of blocks doing various N functions. And they are interconnected through variables.
Performance Tip: The more blocks you can split your query, the better. Because each block is executed concurrently. This implies a faster execution of your query.
Aggregation Query
Aggregation block is where we consolidate data from a query.
Fragments
Fragments is an inspiration from GraphQL. It is used to organize the blocks in the query and avoid repetition in very large queries.