I haven’t fully followed the queries that led to this, but would something like SELECT SUM(OLD -NEW) FROM some_table WHERE need_to_calc IS true; get you anywhere? I’m also thinking of a lag within the list, to assign them all at once, but the commands coming to memory are from statistical packages, Fortran, spreadsheets, and other matrix math . . .