I have the following query window in my application. I want an update on when the Employee event is coming the first time (a new Employee ) OR if there is any update for an existing Employee. My application is getting a lot of updates and I suspect the below Window is not keeping only the last two records in memory and due to that memory uses increase with time. Is there any way I can ensure that only last two records are available in Window?
@name('stmtUpdateEmployee') select * from Employee#groupwin(empId)#length(2)
where
prev(1, age) <> age OR
prev(1, dept) <> dept OR
prev(1, address) <> address OR
prev(1, empId) is null;