1. 28

  2. 9

    I don’t know about MySQL, this is not a database I would pick for any task really. I have successfully used Postgres as a task queue backend and I can definitely recommend it. I find using Postgres for a task queue a better choice than using RabbitMQ or Redis. This is possible thanks to locking with SELECT FOR UPDATE SKIP LOCKED. Assuming you are already using Postgres for your project, in addition to limiting the amount of dependencies, you have a great introspection tool: psql + SQL. Delayed tasks is also not an issue with Postgres.

    Please notice that I am talking about a task queue, that will be responsible for managing some sort of background tasks. I do not know if this setup might be a good choice for other queue use cases like a message bus or event sourcing.

    There are some projects that implement a task queue on top of Postgres, but implementing one from scratch is not a big effort as well.

    Already in 2013, Postgres was good enough for that use case. I imagine it only got better since then. https://news.ycombinator.com/item?id=21536698

    1. 6

      People were using MySQL (and Gearman) for this before Redis and RabbitMQ even existed (or were widely known), at least in PHP land, so if it could do it 15y ago (wouldn’t try with myISAM) it can probably still do it now.