Striim 3.9.7 documentation

Bound data continuously by event count

Alternatively, you could bound the window by event count:

CREATE WINDOW ProductData_100
OVER RetailOrders
KEEP 100 ROWS
PARTITION BY sku;

CREATE CQ GetProductActivity100
INSERT INTO ProductTrackingStream
SELECT pd.sku, SUM(pd.orderAmount)
FROM ProductData_100 pd;

Every time an order is received, the oldest order for that SKU is dropped and the output stream receives a new event updating the number of orders and the total amount for those orders. COUNT(*) is unnecessary since the window always contains 100 events. (PARTITION BY sku means the window will contain the data for the most recent 100 orders for each SKU. Without this clause, the window would contain 100 events total for all SKUs.)