Open topic with navigation

TIBCO BusinessEvents® Enterprise Edition 6.3.1

# Working With Implicit Windows

Implicit windows are created when the continuous query does not have an explicit policy (window) clause.

The lifecycle of an entity within an implicit window is affected by the life cycle of that entity in the cache:

- When an entity in the scope of the query is added to the cache or is updated in the cache, it is automatically added to the window.
- When an entity is deleted from the cache, it automatically exits the window.

Deletion of entities may cause an update of the query output, depending on the query text.

## Example 1

    select count(*) from /EventA evt group by 1;

This example uses a dummy group, required because aggregate functions, `count(*)` in this case, require a `group by` clause to work on all the rows. See Using a Dummy Group Expression for Aggregation for more details.

Suppose that for the first 10 minutes after the query statement is executed, 100 events are created in quick succession. Every time the query receives a new event notification, the count goes up progressively until it stabilizes at 100.

Suppose that thirty minutes later, 50 of those 100 events are consumed by a rule or expire because of their time to live (TTL) settings. The events are deleted from the cache. The query receives deletion notifications and the query output, `count(*)`, changes until it drops and stabilizes at 50.

## Example 2

The following query joins Department and Student entities using the department name. It then keeps a count and an average of age of students per department.

    select d.name, count(*), avg(s.age)
      from /Department d, /Student s
      where d.name = s.deptName
      group by d.name;

The following query keeps count of the number of students per department. Every time a student enrolls or leaves, the count changes and the query produces the entire list sorted on the count.

    select s.deptName, count(*)
      from /Student s
      group by s.deptName
      order by count(*);

Did you find this helpful?

YesNo
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO BusinessEvents® Enterprise Edition

Copyright © 2004-2024. Cloud Software Group, Inc. All Rights Reserved.