Streaming Aggregation and Windowed Aggregation

<< Click to Display Table of Contents >>

Navigation:  Understanding Streaming SQL Concepts > Time and Streaming Data > Rowtime Bounds > Semantics of Rowtime Bounds >

Streaming Aggregation and Windowed Aggregation

Previous pageReturn to chapter overviewNext page

Aggregation applies summarizing functions (like COUNT, SUM, or MAX) to groups of rows. A group always consists of a consecutive series of rows (with rowtimes in a single interval). A group is defined by the count of rows it contains or (more usually) the length of time the rows span. For example, given a stream of events with rowtype (seqno integer, classification varchar(16), cost money), we can count events over each successive hour, which is a streaming aggregation, or we can compute a running average cost of the events of the last hour, which is a windowed aggregation. The streaming aggregation produces a value at the end of each group. The windowed aggregation produces a new value on every input row: that is, whenever the rows in the window change.

Both aggregation cases, streaming and windowed, depend on input rowtimes to trigger output:

Streaming aggregation needs to know when a time period has ended.
Windowed aggregation needs to know when the window has moved forward.
oMore precisely, it needs to know when the window contents change, that is, when a row enters or is dropped from the window.

So for aggregation to make efficient progress, as with union/merge above, both cases need to know the rowtime of the next row. Rowtime bounds thus allow aggregation to produce results as soon as possible.

For examples of the effect of rowtime bounds:

On windowed aggregation, see the topic Analytic Functions in the s-Server Streaming SQL Reference Guide.
On streaming aggregation, see the  topic Aggregate Functions in the s-Server Streaming SQL Reference Guide.