Other Count-Based Windows

A description of the KEEP LAST ROW and KEEP ALL count-based windows.

A KEEP LAST ROW window keeps only the most recent row from the stream. It is functionally identical to a KEEP 1 ROW window. This becomes very important when two or more data sources are joined together in a single query as you will see in a later example.

A KEEP ALL window keeps every row that arrives. Rows never expire. This is useful for certain kinds of historical calculations.

Note:

Because a KEEP ALL window retains all rows that arrive in the stream, it is potentially very costly in terms of resources, and may eventually use up all available memory on your system. Use this type of window only when you have allocated sufficient resources for it or when you know that the window can't grow too large. Alternatively, you may use a named window with KEEP ALL and provide a way of explicitly deleting unneeded rows as necessary.


Created March 8, 2010. Send feedback on this help topic to Sybase Technical Publications: pubs@sybase.com