Skip to content
RED SAGSkills
medium10 pts · first answer countsdatabaseslockingqueues

Several workers taking jobs from a table

Five workers poll a jobs table. With plain FOR UPDATE they wait on each other for the same job row. Which query lets each worker grab a different job?

SELECT id FROM jobs
WHERE status = 'pending'
ORDER BY id
LIMIT 1
FOR UPDATE ???;
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions