sum part of sql takes a lot longer time

Database
Kks
Enthusiast

sum part of sql takes a lot longer time

Hi,

this is a sql tuning question ,

I have a sql which does the sum but the sum step takes a lot of time
can you let me know how to tune so that teradata quickly perform sum part

thanks
1 REPLY
Junior Contributor

Re: sum part of sql takes a lot longer time

Without any information this is hard to tell.

If it's a query with some joins on large tables in it try to calculate the sum as soon as possible in a Derived Table, e.g.

select sum(t1.col), ...
from t1 join t2 on ...

vs.

select sumcol, ...
from (select sum(col),... from t1)
join t2 on ...

Dieter