Re:In Praise of PostgreSQL
by majewsky on Friday August 06, 2021 @06:32AM
(#28085328)
Is there a MySQL equivalent for "FOR UPDATE SKIP LOCKED"? That's a feature that I've fallen in love with because it has completely eradicated the need to have a message queue like RabbitMQ or whatever. For example, for distributing jobs to background workers, I just insert them into a jobs table and have the workers poll for jobs with:
Then just commit the respective transaction on success or rollback on failure. Would this look as simple as that in MySQL?
[ Parent
| on HN ]
MySQL 8 supports FOR UPDATE SKIP LOCKED [1], but does not have a RETURNING clause.
MariaDB 10.5+ supports a RETURNING clause, and 10.6 now has FOR UPDATE SKIP LOCKED. This is quite new though (10.6 went GA a month ago) so there might be some wrinkles.
[1] https://mysqlserverteam.com/mysql-8-0-1-using-skip-locked-an...