Query Windows

Continuous queries use windows. A window is a boundary for analyzing data streams. It is a container in which events and concepts are held and processed by the query. The events or entities enter and leave the window as determined by the window type and how it is configured.

One query can contain multiple windows, and the contents of these windows can be analyzed and compared.

Windows can be divided into two basic types, explicit and implicit.

Explicit windows (sliding, tumbling, and time windows) define the window boundary, that is, a condition that limits the lifecycle of the entities in the window.

With implicit windows, the lifetime of the entities themselves control the lifecycle of the entities in the implicit window. Implicit windows process changes, additions, and deletions affecting the specified entities until the query ends.

Types of Windows

See Working With Sliding Tumbling and Time Windows for content that applies to all these types of explicit windows.

Implicit Window
 Has no policy clause. Instead a group by clause in the select statement of a continuous query determines that the query is using an implicit window. See Working With Implicit Windows.
Sliding Window
 The policy clause specifies a queue size, into which entities flow. When the queue is full and a new entity arrives, the oldest entity in the queue is removed from the window (FIFO). See Sliding Window Examples (Cache Queries)
Tumbling Window
 The policy clause specifies a queue size as a certain number of entities, and empties each time the maximum size is exceeded. Emptying the window completes one cycle. The lifetime of an entity in the window, therefore, is one cycle. See Tumbling Window Examples (Cache Queries)
Time Window
 The policy clause specifies a time period during which entities remain in the window. See Time Window Examples (Cache Queries).