System and method for processing continuous queries with aggregating functions using accumulators
A method, computer program product, and computing system for processing a continuous query including an aggregating function. An accumulator associated with the aggregating function is identified. A current aggregation result is generated for the aggregating function of the continuous query without accessing every entry of the accumulator. A continuous query result is generated for the continuous query using the accumulator associated with the aggregating function.
1 . A method, comprising:
processing a continuous query directed to a database, the continuous query comprising an aggregating function to be applied over a set of elements of the database;
identifying an accumulator, associated with the aggregating function, that stores one or more values from the set of elements of the database identified by the aggregating function;
determining an aggregation result for the aggregating function based on a subset of the one or more values from the set of elements of the database stored in the accumulator;
storing, in the accumulator, the aggregation result of the aggregating function of the continuous query; and
generating a continuous query result for the continuous query based on the aggregation result stored in the accumulator associated with the aggregating function.
2 . The method of claim 1 , further comprising:
persisting the accumulator to a storage device.
3 . The method of claim 1 , wherein the accumulator is one of a single value accumulator and a lazy sorted set accumulator.
4 . The method of claim 1 , wherein generating the aggregation result comprises generating the aggregation result without reading every entry of the accumulator.
5 . The method of claim 1 , wherein generating the aggregation result comprises updating the accumulator without writing every entry of the accumulator.
6 . The method of claim 1 , wherein generating the aggregation result comprises updating an existing entry from the entries of the accumulator.
7 . The method of claim 1 , wherein generating the aggregation result comprises removing an entry from the entries of the accumulator.
8 . A computing system comprising:
a memory; and
a processor operatively coupled to the memory, the processor configured to;
process a continuous query directed to a database, the continuous query comprising an aggregating function to be applied over a set of elements of the database,
identify an accumulator, associated with the aggregating function, that stores one or more values from the set of elements of the database identified by the aggregating function,
determine an aggregation result for the aggregating function based on a subset of the one or more values from the set of elements of the database stored in the accumulator,
store, in the accumulator, the aggregation result of the aggregating function of the continuous query,
generate a continuous query result for the continuous query based on the aggregation result stored in the accumulator associated with the aggregating function, and
persist the accumulator to a storage device.
9 . The computing system of claim 8 , wherein the accumulator is a single value accumulator.
10 . The computing system of claim 8 , wherein the accumulator is a lazy sorted set accumulator.
11 . The computing system of claim 8 , wherein to generate the aggregation result the processor is configured to generate the aggregation result without reading every entry of the accumulator.
12 . The computing system of claim 8 , wherein to generate the aggregation result the processor is configured to update accumulator without writing every entry of the accumulator.
13 . The computing system of claim 8 , wherein to generate the aggregation result the processor is configured to update an existing entry from the entries of the accumulator.
14 . The computing system of claim 8 , wherein to generate the aggregation result the processor is configured to remove an entry from the entries of the accumulator.
15 . A non-transitory computer readable storage medium having instructions stored thereon which, when executed by a processor, cause the processor to:
process a continuous query directed to a database, the continuous query comprising an aggregating function to be applied over a set of elements of the database;
identify an accumulator, associated with the aggregating function, that stores one or more values from the set of elements of the database identified by the aggregating function;
determine an aggregation result for the aggregating function based on a subset of the one or more values from the set of elements of the database stored in the accumulator,
store, in the accumulator, the aggregation result of the aggregating function of the continuous query; and
generate a continuous query result for the continuous query based on the aggregation result stored in the accumulator associated with the aggregating function.
16 . The non-transitory computer readable storage medium of claim 15 , wherein the processor is further to:
persist the accumulator to a storage device.
17 . The non-transitory computer readable storage medium of claim 15 , wherein to generate the aggregation result the processor is to generate the aggregation result without reading every entry of the accumulator.
18 . The non-transitory computer readable storage medium of claim 15 , wherein to generate the aggregation result the processor is to update the accumulator without writing every entry of the accumulator.
19 . The non-transitory computer readable storage medium of claim 15 , wherein to generate the aggregation result the processor is to update an existing entry from the entries of the accumulator.
20 . The non-transitory computer readable storage medium of claim 15 , wherein to generate the aggregation result the processor is to remove an entry from the entries of the accumulator.