Specifies the data aging policy.
AGES EVERY agingTime SET agingField [maxAgingFieldValue TIMES] [FROM agingTimeField]
agingTime |
The time interval,specified in hours, minutes, seconds, milliseconds, or microseconds, after which the data aging process begins. It may be specified using a combination of the allowed units (for example, 3 MINUTES 30 SECONDS). Can also be specified using the interval parameter. |
agingField |
The field in the record that is incremented by 1 every time the agingTime period elapses and no activity has occurred on the record. |
maxAgingFieldValue |
(Optional) The maximum value that agingField is incremented to. If not specified, agingField is incremented once. Can also be specified by the interval parameter. |
agingTimeField |
(Optional) The field containing the start time for the aging process. For example, if the period of time specified in the agingTime column has elapsed, the data aging process begins. If not specified, the internal row time is used. If specified, the field must contain a valid start time. |
When the predefined time period (agingTime) elapses, an integer field in the record (agingField) is incremented once, or until a predefined maximum value (maxAgingFieldValue) is reached. The start time of the aging process is specified through the (agingTimeField) field in the record.
If the start time is not explicitly specified, the internal row time is used. When the aging process begins, agingField defaults to 0, and it is incremented by 1 whenever the predefined time period elapses. If a record is updated after aging commences, agingField resets to 0 and the process restarts. If a record is deleted, no aging updates are generated.
When insert is received, the count field sets to 0, the insert is passed through, and aging begins.
Aging starts only after the specified inactivity period. If the data ages every five seconds, then the record must remain inactive for five seconds before it starts counting. A record is considered inactive when no updates or deletes have occurred.
When delete is received, aging stops and the delete is passed through. An update of a record resets the counting to 0.
This example creates an output window named AgingWindow. The age column for the output window updates every 10 seconds 20 times.
CREATE OUTPUT WINDOW AgingWindow SCHEMA ( AgeColumn integer, Symbol STRING, Ts bigdatetime ) PRIMARY KEY (Symbol) AGES EVERY 10 SECONDS SET AgeColumn 20 TIMES AS SELECT 1 as AgeColumn, TradesWindow.Symbol AS Symbol, TradesWindow.Ts AS Ts FROM TradesWindow ;