News for hackers. Stuff that matters.
Re:Do you really need Redis? How to get away with just Postg... by cerved on Saturday June 12, 2021 @05:01AM (#27482916)
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

There are no comments on this comment yet.