zlacker

[parent] [thread] 0 comments
1. cerved+(OP)[view] [source] 2021-06-12 09:01:56
no you don't but it's a lot better to do an atomic select/update IMHO.

Basically you have status = 0,1,2 for queued, processing, done. You have a filtering CTE that returns the queued rows, sort by id and update status = status +1 of the top one.

You can even get fancy and disallow updates on the status column for other users to make it immutable.

I've done this in SQL server in a very similar way to as explained in the post

[go to top]