hard20 pts · first answer countspostgresqlconcurrencymessage-queues
Workers block each other on a jobs table
Ten workers each run SELECT ... FROM jobs WHERE status = 'pending' ORDER BY id LIMIT 1 FOR UPDATE. They end up waiting on the same row and process jobs one at a time. What fixes this?