A Postgres job queue that stays fair under load
Jobs in Postgres, idempotency keys, and round-robin scheduling across tenants.

README.md · CASE STUDY
Jobs in Postgres, idempotency keys, and round-robin scheduling across tenants.
Jobs in Postgres, idempotency keys, and round-robin scheduling across tenants.
One tenant enqueued 50,000 jobs and every other tenant waited 41 seconds for theirs. The queue was fair to jobs and unfair to people.
Design
Workers claim one job at a time with FOR UPDATE SKIP LOCKED, rotating through tenants. A unique index on tenant and idempotency key turns a retried enqueue into a no-op, which is why billing jobs never ran twice.
Numbers
The quiet tenant’s p95 pickup went from 41 seconds to 38 ms. Throughput stayed at about 12,000 jobs per second on a single node.
More projects.
Every project opens the same way: problem, fix, numbers.
Notes from the work.
Short write-ups of things that broke and how they got fixed. Plain language, real numbers.