Jul 29, 2026 · 1 min read
SKIP LOCKED is a perfectly good queue
Before you add a message broker for background jobs, try the database you already run.
Every team I have joined has, at some point, wanted to add a queue. Usually a whole new system with its own cluster and its own on-call pain. Often the jobs are a few thousand a minute.
Postgres can do this. The trick is SELECT ... FOR UPDATE SKIP LOCKED: each worker grabs a row nobody else is holding and ignores the rest. No double processing, no central coordinator.
The shape we use
A jobs table with status, run_at, attempts and a payload column.
Workers in Go that loop: pick up to 50 due jobs with SKIP LOCKED, process, mark done in the same transaction.
A partial index on (run_at) where status is pending, so the pick query stays fast as done jobs pile up.
A nightly job that deletes done rows older than a week. Yes, a job that cleans up jobs.
When it is not enough
If you need fan-out to many consumers, strict ordering across a huge stream, or hundreds of thousands of messages a second, use a real broker. We do, for the warehouse scan events.