Developing Apama Applications > Developing Apama Applications in EPL > Working with Streams and Stream Queries > Troubleshooting and stream query coding guidelines > In some cases prefer retain all to a timed window
In some cases prefer retain all to a timed window
When you specify retain all in a stream query the correlator does not retain the items indefinitely. The correlator processes each new item when it arrives (for example, it might execute an aggregate function) and then discards it. Consequently, queries that specify retain all use less memory than queries that define time-based or size-based windows.
A situation that typically tempts you to define a time-based window is when you want to calculate some aggregate values for a session. For example, a session could be from the start of a day to the end of a day, or an incoming event could initiate a session that requires aggregated values such as placing an order in an automated trading system.
After the session begins, interest in the aggregated values usually continues until the session ends, for example at the end or day or when the full volume of the placed order has been traded. In situations such as these, use a retain all window instead of a within session window.
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.