Which one of this two views require less CPU?
I'm currently checking the sentences of some views and need to know if there is some performance improvement if concat functions are replaced by double pipes.
create view VIEW1 as
select concat(concat(concat(concat(concat(concat(concat(concat(concat(A, B),C),D),E),F),F),G),H),I) from TABLE
create view VIEW2 as
select A||B||C||D||E||F||G||H||I from TABLE
From Information Center:
The CONCAT function is identical to the CONCAT operator. For more information, see With the concatenation operator.
So, the definitive answer is: they're the same. However, IBM does have this to say:
Vertical bars (or the characters that must be used in place of vertical bars in some countries) can cause parsing errors in statements passed from one DBMS to another. The problem occurs if the statement undergoes character conversion with certain combinations of source and target CCSIDs. Thus, CONCAT is the preferable concatenation operator.
I don't think there will be performance difference, but using pipes-makes it easier to read.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With