← Back to context

Comment by orangepanda

3 years ago

As I understand, with SKIP LOCKED rows would no longer be processed in-order?

Yes, but if you're going through the queue with multiple workers in parallel, you lose ordering guarantees anyway.

article says he also uses "order by" clause, but I am wondering if it will severely limit throughput since all messages will need to be sorted on each lookup, but this probably can be solved by introducing index.

  • It seems strictly worse to use ORDER BY in this case, since if you're using SKIP LOCKED you should be doing parallel processing anyway, and if you're doing parallel processing, ordering is already going out the window.