Archives of the TeradataForum
Message Posted: Wed, 12 Oct 2005 @ 15:10:19 GMT
Victor Sokovin wrote:
I don't think it's similar, because the algorithm for ROLLUP is simpler: find the finest granularity of aggregation, calculate it and then repeatedly aggregate the data:
rollup(a,b,c) -> group by (a,b,c) into spool 1 -> group spool 1 by (a,b) into spool 2 -> group spool 2 by (a) into spool 3 -> group spool 3 into spool 4
The result is simply a union of those spools.
It's a bit more complex for GROUPING SETS, but i think even i could program that algorithm ;-)
The performance for the lowest level is similar to a group by on those columns. This is the main overhead, each following aggregation works on a shrinking set.
At least it's faster than the traditional query: UNION ALL different agregations...
|Copyright 2016 - All Rights Reserved|
|Last Modified: 28 Jun 2020|