Archives of the TeradataForum
Message Posted: Mon, 23 Jul 2007 @ 14:15:07 GMT
The OLAP functions will always redistribute the qualifying rows of the table by values (based on partition and order by clause). The normal aggregate functions can avoid a redistribution if the primary index columns are the same or a subset of the columns that you're using in your "GROUP BY" clause.
If you run an explain on the aggregation case, you can see whether or not a "local" aggregation or a "global" aggregation is performed. If a "local" aggregation is performed, then the rows are not being redistributed and this may turn out to be faster. If the aggregation is not local, then I would think the OLAP function would turn out to be better.
If this is something that you're going to run often, I would suggest that you try it both ways and capture the CPU and IO used by both to determine which is the best approach.
|Copyright 2016 - All Rights Reserved|
|Last Modified: 15 Jun 2023|