Methods are provided for efficiently evaluating database queries including
multiple rollup operators. With the computation of grouping identifiers to distinguish
grouping levels of each rollup operator, evaluation of database queries that include
concatenation of rollup operators includes nesting of the rollup operators and
includes the grouping identifiers as sorting keys for subsequent processing. Furthermore,
to optimize the query evaluation process, the order in which the rollup operators
are computed can be determined based on cardinalities that estimate the number
of records generated by each rollup operator, and parallel evaluation can be utilized
by partitioning data records between rollup operator processing stages based on
the grouping keys associated with the rollup operators that are not being processed
at the next stage. If the query includes an algebraic aggregate function, the algebraic
function is represented as distributive functions, which are propagated through
the evaluation stages and used to compute the algebraic function at the final rollup stage.