-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Execution
-
None
-
None
-
None
-
None
-
None
-
None
-
None
If a pipeline contains repeated expressions like MatchWithLargeExpression benchmark
( $a > X and $b > Y) or ( $a > Z and $b > W) or ..
each comparison term will be followed by a check on $a or $b being not null. This expression could be precomputed just after evaluating the path and reused from the variable.
Similarly, queries involving $a.b and $a.c could have the path $a precomputed in a variable and have the traverseP start from this variable.
If the stage builder had a walker of ABT trees that can identify identical subtree, it could define a new variable definition right after the last dependency is computed and replace the clones with the variable reference.
Care must be taken into avoid removing multiple invocations of non-deterministic operations (rand()) or moving operations before "if" statements that would check the validity of the input values (e.g. to avoid division by zero)