How do we calculate MAX in teradata

Database
Enthusiast

How do we calculate MAX in teradata

Hi,

I have a salary_table and I want to fetch the maximum of Net_Amt from that.
I want to know how does teradata get this maximum value.So I get the explain plan which is as follows:

explain
sel max(Net_Amt) from dbname.salary_table;
Explanation
--------------------------------------------------------------------------------
1) First, we lock a distinct dbname."pseudo table" for read on a
RowHash to prevent global deadlock for dbname.salary_table.
2) Next, we lock dbname.salary_table for read.
3) We do an all-AMPs SUM step to aggregate from
dbname.salary_table by way of an all-rows scan with no
residual conditions. Aggregate Intermediate Results are computed
globally, then placed in Spool 3. The size of Spool 3 is
estimated with high confidence to be 1 row (23 bytes). The
estimated time for this step is 0.03 seconds.
4)...
5)...
Can any one explain what does " all-AMPs SUM step to aggregate from dbname.salary_table" mean in step 3.

Thanks in Advance,
Kishore
Tags (2)
1 REPLY
Enthusiast

Re: How do we calculate MAX in teradata

Hi,
The step 3 is make in parallel mode in all AMPs, then those partial results are put in the spool 3 and finally find here the max amount.

Regards.