Delay simple filter queries with the OUTPUT AFTER clause so that all rows leaving the query will leave five seconds after they enter.
INSERT INTO StockTradesAll SELECT * FROM StockTrades WHERE symbol = 'AAPL' OUTPUT AFTER 5 SECONDS;
This query is very similar to one of the queries in an earlier chapter except for the addition of the OUTPUT AFTER clause. In the original query, the output rows came out of the query at the same time as they went in, with the original timestamp intact. In this query, the output rows will be delayed by five seconds and will have new timestamps based on the delay.
The delay that is introduced will cause these rows to be processed by any subsequent queries in the query pipeline of the module five seconds after the rows arrived in the original query.
Here is an illustration of how this delayed output works: