Subject Re: [firebird-support] Optimizer tricks was Re: Count(id) returns null
Author Dmitry Yemanov
"Ann W. Harrison" <aharrison@...> wrote:
>
> Do you have specific examples? The case that started this was
> WHERE 1 = 0 - a condition that can be evaluated at compile time as
> false. Is it actually worth testing whether both sides of an
> equality can be evaluated at compile time and performing the
> evaluation?

Yes. Moreover, there should be several levels of evaluation:

1) compile time (constant expressions)
2) execution start time (invariant expressions)
3) fetch time (everything else)

Perhaps (1) and (2) could be both defered to the execution time to simplify
the code.

P.S. Just think about various (including hand-made) SQL
constructors/generators.


Dmitry