Position of Operators
Place Filters as Early as Possible
The FILTER operators make it possible to reduce the size of the dataset processed by the query, and therefore reduce the cost of subsequent processing. It is beneficial to filter the dataset as early as possible in the query. Position the most discriminating filters first.
Similarly, try to position first the data filtering operations that you can run using the
List.filter() function in the Expression
Language, as they reduce the number of documents processed in the dataset.
Place Resource-Intensive Operations as Late as Possible
Put processing operations that are CPU or memory intensive as close to RESULT
SET operators as possible, that is to say as “late” as possible in the
query. These include aggregations, sorts, joins, graph traversers, or expressions using a
lot of arrow operators (->).
Put the operators, which increase the dataset volume by duplicating elements, at the end of the query. These include TO STREAM, JOIN, and GRAPH TRAVERSER.

Do Not Factorize Resource-Intensive Operations on Several RESULT SET Operators If Not Required
If your data query contains several RESULT SET operators, do not link an operation that applies to a single RESULT SET to all the others. Each RESULT SET operator does not necessarily use the entire dataset to display a visualization. For example, a table visualization only displays the first rows of the dataset because this visualization paginates values.
This is obviously only possible when the result of the processing in question has no impact on upstream operators, such as a FILTER operator for example.








