Early evaluation of constant expressions
- Last Updated: February 11, 2026
- 1 minute read
- OpenEdge
- Version 13.0
- Documentation
This is the first phase of optimization (introduced from 11.6). In this phase query tree is iterated over recursively to find the constant expressions. If the expression can be evaluated then values for the constants are peeked and the expression is evaluated. The expression is replaced with the result of the constant expression. This reduces execution time considerably as it eliminates the evaluation of expression for each row during the execution.
The following example shows evaluation of constant expression in peek_evaluate_consts phase. Assuming that the Where condition is as follows:
|
After evaluating the constant expressions, the Where condition is transformed as shown below.
|
Note: If any of the constant expressions are evaluated for a query, the query plan is marked as
not re-usable. Due to the evaluation of constant expressions the query plan has become valid
only for a set of constants hence it cannot be re-used for another set of constant values.