A computer is programmed to process a continuous query that is known to
perform a new aggregation on one or more stream(s) of data, using one or
more other aggregations on the stream(s). The computer creates an
operator to execute the continuous query, and schedules the operator for
execution in a specific order. In several embodiments, the computer
determines the order based on dependency of the new aggregation on other
aggregation(s), and on the order of performance of the other
aggregation(s). The new aggregation is scheduled for performance after
performance of each of the other aggregations. The computer is further
programmed to pass results of the other aggregations to the new
aggregation, by execution of a predetermined function. Support for use of
the other aggregations results within the new aggregation eliminates
redundant computation of the other aggregations within the new
aggregation. The new aggregation may be user defined or built-in.