You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is already a community implementation (e.g. taskiq-postgresql / taskiq-postgres) that provides a PostgreSQL-based broker (often together with result backend and scheduler source). This suggests there is a real demand for running Taskiq without Redis/RabbitMQ, especially in environments where PostgreSQL is already the only allowed infrastructure component.
In my case, I would strongly prefer not to introduce Redis at all, mainly because of the additional operational complexity and the cost of maintaining a highly available Redis cluster in production. Being able to rely solely on PostgreSQL (which we already operate in HA) is a big advantage.
From my perspective, an official PostgreSQL broker would be valuable even if it is initially minimal:
no hard requirement to cover scheduler or result backend
focus on correctness, visibility, and Taskiq-native semantics
clear guidance on trade-offs (LISTEN/NOTIFY vs polling, locking strategy, etc.)
Even a “simple but official” broker would give users more confidence than relying on third-party implementations for core message delivery.
Happy to help with testing, design discussion, or documenting constraints if this moves forward.
There's a few problems with using postgres as a task queue. As I see it:
postgres' NOTIFY sens message to ALL clients. Which means that you will receive as many messages as you have workers. Which is undesireable behavior in most of cases.
NOTIFY/LISTEN mechanism doesn't have any delivery guarantess. In redis for example we use streams to ensure deliverability and acknowledgement.
Using tables for tracking tasks will have poor performance. Because all operations will have select-for-update semantics which has its performance cost.
Considering all from the above I think that implemening full broker interface on postgres can have negative impact on experience of using taskiq.
Thanks a lot for the detailed explanation – it makes sense and I absolutely agree that PostgreSQL is not a great fit for a high-throughput, default broker in Taskiq.
That said, I think there is still a valid space for a non-default, “constrained” PostgreSQL broker implementation, if its design explicitly avoids some of the pitfalls you mentioned and clearly documents the trade-offs.
On the NOTIFY broadcasting point:
It’s true that NOTIFY sends to all listeners, but many existing PG-based job queues treat NOTIFY only as a “wake up signal”, not as the actual transport for tasks.
The real dequeue semantics can be implemented on top of a jobs table with something like SELECT … FOR UPDATE SKIP LOCKED LIMIT 1, so only one worker actually locks and processes a given row. In that model, extra NOTIFY wakeups mostly result in harmless “no work” checks, not duplicated processing.
On reliability:
I fully agree that NOTIFY/LISTEN itself has no delivery guarantees.
But if we rely on the jobs table as the source of truth (with status = pending/in_progress/done, timeouts, retries, etc.), NOTIFY is only an optimization to reduce polling latency. If a notification is dropped, workers will still eventually pick up pending jobs via polling, so reliability comes from the table + transactions rather than from NOTIFY.
On performance and UX:
I completely agree that a PostgreSQL broker should never be the recommended solution for high volume, short-lived tasks. Redis/RabbitMQ are much better there.
However, there are environments where:
PostgreSQL is already operated in HA,
introducing Redis requires significant extra operational and HA cost,
and the expected throughput is modest (e.g. tens of workers, tens/hundreds of jobs per second).
For those setups, even a slower broker with well-understood limits and a clearly documented “this is not for high throughput” label could be very valuable.
From my perspective, it would already be a big win to have:
a minimal, officially supported PostgreSQL broker,
clearly marked as non-default / limited throughput / best-effort,
using NOTIFY only as a wake-up hint and putting reliability in the job table and transaction model.
This way, the default Taskiq experience remains unchanged (Redis/RabbitMQ for serious queues), but users who consciously accept the trade-offs and want to stay on PostgreSQL only still have an official, supported path.
Happy to help with experimentation, benchmarks on realistic workloads, or writing documentation about the constraints, if that would be helpful.
Activity
alario-tang commentedon Nov 6, 2025
+1
danfimov commentedon Dec 6, 2025
You can try taskiq-postgres[psqlpy]. I already implemented broker there
alario-tang commentedon Dec 21, 2025
I want to add some context from real-world usage.
There is already a community implementation (e.g. taskiq-postgresql / taskiq-postgres) that provides a PostgreSQL-based broker (often together with result backend and scheduler source). This suggests there is a real demand for running Taskiq without Redis/RabbitMQ, especially in environments where PostgreSQL is already the only allowed infrastructure component.
In my case, I would strongly prefer not to introduce Redis at all, mainly because of the additional operational complexity and the cost of maintaining a highly available Redis cluster in production. Being able to rely solely on PostgreSQL (which we already operate in HA) is a big advantage.
From my perspective, an official PostgreSQL broker would be valuable even if it is initially minimal:
Even a “simple but official” broker would give users more confidence than relying on third-party implementations for core message delivery.
Happy to help with testing, design discussion, or documenting constraints if this moves forward.
s3rius commentedon Dec 22, 2025
There's a few problems with using postgres as a task queue. As I see it:
select-for-updatesemantics which has its performance cost.Considering all from the above I think that implemening full broker interface on postgres can have negative impact on experience of using taskiq.
alario-tang commentedon Dec 23, 2025
Thanks a lot for the detailed explanation – it makes sense and I absolutely agree that PostgreSQL is not a great fit for a high-throughput, default broker in Taskiq.
That said, I think there is still a valid space for a non-default, “constrained” PostgreSQL broker implementation, if its design explicitly avoids some of the pitfalls you mentioned and clearly documents the trade-offs.
On the NOTIFY broadcasting point:
SELECT … FOR UPDATE SKIP LOCKED LIMIT 1, so only one worker actually locks and processes a given row. In that model, extra NOTIFY wakeups mostly result in harmless “no work” checks, not duplicated processing.On reliability:
status = pending/in_progress/done, timeouts, retries, etc.), NOTIFY is only an optimization to reduce polling latency. If a notification is dropped, workers will still eventually pick up pending jobs via polling, so reliability comes from the table + transactions rather than from NOTIFY.On performance and UX:
From my perspective, it would already be a big win to have:
This way, the default Taskiq experience remains unchanged (Redis/RabbitMQ for serious queues), but users who consciously accept the trade-offs and want to stay on PostgreSQL only still have an official, supported path.
Happy to help with experimentation, benchmarks on realistic workloads, or writing documentation about the constraints, if that would be helpful.