PgQueuer alternative
A Postgres-backed queue without the workers.
PgQueuer gets a lot right: jobs live in Postgres, not a broker, and there's no separate scheduler. But the work still runs in async Python workers you deploy, scale and watch. Workly keeps Postgres and drops the workers. Your job is an endpoint in the app you already deploy, in any language, and Workly calls it, with retries, rate limits and schedules, and keeps every attempt.
The jobs stay in Postgres; the work moves to your app.
Workers pull; Workly pushes. Since the work happens in an HTTP request to your app, what's around it changes.
Workly and PgQueuer compared.
Both keep jobs in Postgres, deliver at least once and deduplicate on enqueue. The differences are in who runs the work, what's on by default, and what you can see afterwards.
| PgQueuer | Workly | |
|---|---|---|
| Model | A Python library: async workers claim jobs from your Postgres with FOR UPDATE SKIP LOCKED | A server: Workly pushes each task to your endpoint as an HTTP request |
| What you run | Worker processes (pgq run), deployed with your code, against your application database | One server plus Postgres, or hosted at workly.run. Your handlers run in the app you already deploy |
| Languages | Python, with async def handlers; sync code can enqueue through psycopg | Any: a handler is an HTTP endpoint, sync or async. Python and TypeScript SDKs |
| Enqueue | In the same transaction as your data, so a job exists only if the row it is about does | An API call, after your transaction commits; an idempotency_key makes retrying it safe |
| Payloads | Bytes; encoding and decoding are up to you | JSON, or any body with its own content type, plus headers |
| Retries | Opt in per entrypoint (DatabaseRetryEntrypointExecutor), or raise RetryRequested; otherwise a failure is final | On by default: backoff with jitter, honours Retry-After, per-queue policy |
| After the last retry | Deleted and logged with its traceback, or kept with on_failure="hold" for pgq requeue | Kept as failed with every attempt, grouped by error; retry one or a whole group once the fix is in |
| Crashed worker | The job is picked up again once its heartbeat is stale (heartbeat_timeout) | No workers to crash. If Workly stops mid-delivery, the attempt is recorded as lost and delivered again |
| Rate limits | Concurrency per entrypoint (concurrency_limit); requests per second was removed in 1.0 | max_concurrency and rate_per_second per queue |
| Deduplication | dedupe_key, while the job is queued or running | idempotency_key, for as long as the task is kept, and a stable Workly-Task-Id header |
| Schedules | @pgq.schedule with cron in UTC, run by the workers | Schedules in the server: cron in your timezone, overlap policy, run history, run-now |
| Fan-in | Not built in: jobs are independent | Task groups: one callback with the counts when every task has finished |
| Workflows | Not built in (River and Oban have workflows in their Pro editions) | DAGs of HTTP steps in workly.yaml, each a task; a step can wait for a task group |
| Visibility | Terminal and web dashboards (pgq dashboard, pgq web), Prometheus, a read-only MCP server, SQL on the log table | Dashboard with every attempt’s status, error and response body, MCP that can also retry and pause, and Prometheus metrics when self-hosted |
| History | pgqueuer_log keeps growing until you prune it | Kept for a set time (7 days by default), then deleted |
| Job length | No limit: a job runs as long as the worker does | One HTTP request: up to 30 minutes per attempt |
PgQueuer behaviour from its documentation (v2.0), November 2026.
An entrypoint becomes an endpoint.
The function body stays the same. It moves behind a route in your web app, gets its arguments from the JSON payload, and answers 2xx when it's done; anything else is retried, with no executor to configure.
import json
from contextlib import asynccontextmanager
from datetime import timedelta
import asyncpg
from pgqueuer import PgQueuer
from pgqueuer.executors import DatabaseRetryEntrypointExecutor
from pgqueuer.models import Job
@asynccontextmanager
async def main():
pool = await asyncpg.create_pool()
pgq = PgQueuer.from_asyncpg_pool(pool)
@pgq.entrypoint(
"send_email",
executor_factory=lambda params: DatabaseRetryEntrypointExecutor(
parameters=params, max_attempts=5,
initial_delay=timedelta(seconds=1),
),
)
async def send_email(job: Job) -> None:
user_id = json.loads(job.payload)["user_id"]
...
yield pgq
# In a request handler
await queries.enqueue("send_email", json.dumps({"user_id": 123}).encode())
# And in production, alongside the app:
# pgq run tasks:mainimport json
from workly import AsyncWorkly, SignatureVerificationError, verify_signature
workly = AsyncWorkly() # WORKLY_URL, WORKLY_API_KEY
# In a request handler
await workly.tasks.enqueue(
"emails",
url="https://api.example.com/tasks/send-email",
payload={"user_id": 123},
)
# The task is an endpoint in the app you already run
@app.post("/tasks/send-email")
async def send_email(request: Request):
body = await request.body()
try:
verify_signature(body, request.headers)
except SignatureVerificationError:
raise HTTPException(401)
user_id = json.loads(body)["user_id"]
...
return Response(status_code=204)And schedules leave the workers.
PgQueuer's schedules run in your workers, in UTC. Workly's run on the server, in the timezone you give them, are retried and signed like tasks, and each run is recorded, with a button to run one now.
from pgqueuer.models import Schedule
# Cron in UTC; runs in whichever worker is up
@pgq.schedule("nightly_report", "0 2 * * *")
async def nightly_report(schedule: Schedule) -> None:
...# workly.yaml, applied with `workly deploy`
version: 1
schedules:
nightly-report:
cron: "0 3 * * *"
timezone: Europe/Stockholm
url: https://api.example.com/tasks/nightly-reportSee why a job failed without writing SQL.
Every task keeps its attempts: status code, error, response body and timing, with nothing to prune. Failed tasks are grouped by error, so after a bad deploy you fix the handler and retry the whole group. Queue depth, delivery rate and the age of the oldest due task are in the dashboard.

When PgQueuer is the better choice.
Jobs must commit with your data
PgQueuer's enqueue is an insert in your transaction: if the order is rolled back, so is its receipt job. Workly is a separate service, so you enqueue after the commit, or write an outbox row and enqueue from it.
Everything is async Python on one database
If the workers are already there and you want the fewest moving parts, a library on the database you run is hard to beat: no service to add, nothing to call over the network.
Jobs run longer than 30 minutes, or there is no web service
Each Workly attempt is one HTTP request. A worker can run a job for hours, and needs no endpoint, which suits scripts and data pipelines.
Questions
- Both use Postgres. What is the difference?
- Where the work runs. PgQueuer is a library: your Python workers poll your database and run the jobs. Workly is a server with its own database that calls your app over HTTP, so there are no workers, and the handler can be in any language. Hosted Workly needs no database on your side at all.
- Can Workly enqueue in the same transaction as my data?
- No. Enqueueing is an API call, so do it after the commit. If the job must never be lost when the call fails, write it to an outbox table in your transaction and enqueue from there; the idempotency key makes sending it twice harmless.
- Does Workly put load on my database?
- Self-hosted, it uses whichever Postgres you point it at: its own, or a separate database on the same server. Hosted, it uses none of yours. With PgQueuer, claims, heartbeats and logs run on the database your application queries.
- What about River, pg-boss or Oban?
- The same comparison holds: they are job libraries on your Postgres, for Go, Node and Elixir. Workly trades the workers for HTTP delivery, and adds retries by default, rate limits per queue, schedules in your timezone and attempt history.
- Is HTTP delivery slower than a worker?
- Slightly: each task is an HTTP request. In Workly's load tests on one server, the median from enqueue to delivery was a few milliseconds at 1,000 tasks a second. For background jobs that is rarely what matters.
- How do I move over gradually?
- Entrypoint by entrypoint. Turn one into an endpoint, enqueue it with Workly instead of queries.enqueue, and keep the rest on PgQueuer until you're ready. The two don't interfere, even on the same Postgres server.
Try it in five minutes.
pip install "workly[cli]" and workly dev give you a server and dashboard on your laptop, with nothing else to start. Or sign in to hosted Workly and get a workspace and an API key in a minute, free on the Hobby plan.