1. A method, comprising: obtaining a data stream; obtaining a set of aggregate queries to be executed on the data stream; and generating a query plan for executing the set of aggregate queries on the data stream, wherein the generated query plan comprises generating at least one intermediate aggregate query, wherein the intermediate aggregate query combines a subset of aggregate queries from the set of aggregate queries so as to pre-aggregate data from the data stream prior to execution of the subset of aggregate queries such that the generated query plan is optimized for computational expense based on a given cost model.