delicate improvements in the subquery could provide diverse results in corner circumstances. For an example of subtle distinctions in execution and outcome established have a look at 5 solutions to apply NOT EXISTS in PostgreSQL. This gives you something which behaves a little bit like an identification column that resets at the beginning of every