How queries are processed

This topic walks you through the steps involved in EQL query processing.

Note:

This abstract processing model is provided for educational purposes and is not meant to reflect actual query evaluation.

Prior to processing each statement, EQL computes source records for that statement. When the records come from a single statement or from a collection, the source records are the result records of the statement or the appropriately filtered collection records, respectively. When the records come from a JOIN, there is a source record for every pair of records from the left and right sides for which the join condition evaluates to true on that pair of records. Before processing, statements are re-ordered, if necessary, so that statements are processed before other statements that depend on them.

EQL then processes queries in the following order. Each step is performed within each statement in a query, and each statement is done in order:
  1. It filters source records (both statement and per-aggregate) according to the WHERE clauses.
  2. For each source record, it computes SELECT clauses that are used in the GROUP BY clause (as well as GROUP BYs not from SELECT clauses) and arguments to aggregations.
  3. It maps source records to result records and computes aggregations.
  4. It finishes computing SELECT clauses.
  5. It filters result records according to the HAVING clause.
  6. It orders result records.
  7. It applies paging to the results.