News for hackers. Stuff that matters.
Re:How do you cut a monolith in half? by vkjv on Friday June 30, 2017 @11:36AM (#14671383)
If you don't need high throughput and otherwise don't have a reason to add a separate technology to the stack just to have a queue, SQL can make a great, simple and reliable queue!

* Postgresql and Oracle with skip locked

* MS SQL Server with readpast

* DB2 with skip locked data

If you use MySQL, it's going to be a bit more difficult.

Re:How do you cut a monolith in half? by burkemw3 on Friday June 30, 2017 @12:17PM (#14671679)
I hadn't heard of skip locked before, and very much enjoyed this article walking through it for postgres: https://blog.2ndquadrant.com/what-is-select-skip-locked-for-...
Re:How do you cut a monolith in half? by swah on Friday June 30, 2017 @12:49PM (#14671924)
Love the headline "Most work queue implementations in SQL are wrong". That kind of stuff makes me read an article...

This short screencast was also very helpful https://www.pgcasts.com/episodes/7/skip-locked/

Re:How do you cut a monolith in half? by monksy on Friday June 30, 2017 @02:06PM (#14672562)
Using the database as a queue is an anti-pattern. There used to be an entire blog series about why this is the case. However, I can't find it at the moment.
Re:How do you cut a monolith in half? by eternalvision on Friday June 30, 2017 @03:02PM (#14672968)
With MySQL, there's a fairly simple trick you can do to build a queue. Set a temp var to null, run an update with a select subquery to update state of next row(s), then select that var to get your queue row pk's.