Atomic “Read + Mark Processed” with UPDATE … RETURNING

1880
0

If you have a queue table, avoid races by selecting and updating in one statement. Postgres UPDATE … RETURNING is the simplest building block for a correct custom queue / maintenance pipeline.