Some time ago, I wrote blogpost about how to pick a task from queue, without locking. It was written in 2013, and as such it couldn't reflect everything we have now in PostgreSQL - namely SKIP LOCKED - which was added ...