window-specification::={ROWSinteger-constant
|RANGEinteger-constant[
time-specification]
|NOW
|PARTITIONBY
column-specification-list
ROWS
integer-constant}
Specifies how long data is retained in a stream. Window specification is entered in a relation reference.
ROWS
Specify a value in the range from 1 to 100,000 for the number of rows that are retained in the stream.
RANGE
Specifies how long data stays in the stream. If you specify time division for a query, you must specify RANGE.
integer-constant
Specifies an amount of time. For the range of integer constant values, see 4.4.16 Time specification.
time-specification
Specifies a unit for the time specified in integer-constant. For details about time specification, see 4.4.16 Time specification.
If you do not specify this, the value specified in integer-constant is assumed to be in seconds.
NOW
Only items currently in the stream will be processed.
PARTITION BY
Applies ROWS processing to each column name value specified in the column specification list.
column-specification-list
For details about specifying a column specification list, see 4.4.13 Column specification list.
For the column specification list, you can specify a column name.
None.
Usage example 1
Specifies that rows remain in the stream in relation s1 for 2 seconds. The underlined part indicates the window specification.
REGISTER QUERY q1 SELECT * FROM s1[RANGE 2 SECOND];
Usage example 2
Specifies that two rows are to remain in the stream for each value of column a in relation s1. The underlined part indicates the window specification.
REGISTER QUERY q1 SELECT * FROM s1[PARTITION BY s1.a ROWS 2];