SQL-Window-Functions It allows you to compare values as they come through. This will use Postgres SQL. There are a number of SQL variations that can use window functions.