Does Teradata have a feature of constant folding?
e.g) The query
select c1/(60*60*24*365) ...
is internally like this?
I've read following manual, but couldn't find it.
Solved! Go to Solution.
I cannot say for certain, but if the optimizer did not do that it would be considered a bug. It works hard to eliminate logical equivalencies and simplify calculations.
Thanks for your reply. I'm relieved to hear that.
If I find the situation which does not optmize it, I will open the issue at T@YS.
Currently, I was just wondering.
> The result of constant folding and general expression algebraic manipulations should be visible in the explain.
I've never seen that a explain refers to algebraic manipulations except for conditions of JOIN/WHERE.
The explain of select 1;(simple calculation) and select 1*2*3*....;(complex calculation) return same following result. Even if I use any table, the only difference is final spool size or completely same. Probably, It means that we can't judge if the optimization is executed. You know a explain doesn't show all detail of a query.
The row is sent directly back to the user as the result of statement 1
I would like to see the sample query or explain if you have it.
Sorry, my first post was not enough. I wanted to know if the optimizations are done on expressions in the select list.
> The same operations will be done on expressions in the select list even though the result is not visible.
Thanks for the information. I hope that it become visible on the explain in future