Developing Apama Applications > Developing Apama Applications in EPL > Working with Streams and Stream Queries > Defining stream queries > Adding window definitions to from and join clauses > Partitioning time-based windows
Partitioning time-based windows
If a window is purely time-based then there is no benefit to partitioning the window. For example, consider the following two queries:
from t in all Tick() within 1.0 ...
from t in all Tick() partition by t.symbol within 1.0 ...
The first query outputs every Tick received in the last second. The second query organizes the stream of Tick events by their symbols, then gives you each one that arrived in the last second. This is still every Tick received in the last second. The correlator ignores a partition by statement if it is used only with a within window.
If your window includes a retain clause as well as a within clause then it can be helpful to use partition by, likewise if there is a with clause. See Defining content-dependent windows. For example:
from t in all Tick() partition by t.symbol within 10.0 retain 5 ...
This window will contain at most 5 Tick events for each different symbol received within the last 10 seconds.
Copyright © 2013 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors.