Query Parsing

The order of the query created becomes important when trying to structure a query for performance.

For example, consider a query:

where "A && (B || C)"

As the kernel parses the query, the expression passed to the database becomes:

(A && B) || (A && C)

The kernel uses ORs at the top level to separate the query into parts, then to accumulate the results. Generally, the processing of a query is done left to right. Knowing this, a user can structure queries so that the indexed attributes are used first. Front loading the query in this manner restricts the sets of objects searched with non-indexed attributes.