What is PostgreMQ?
PostgreMQ is a message queue built on PostgreSQL. Its SQL schema stores publications and each queue's delivery state; Go, Rust, and TypeScript clients provide publishing, consuming, visibility extension, and shutdown APIs. There is no separate queue server or PostgreSQL extension to install.
When application data and PostgreMQ share a database, a transaction can commit application changes and message publication together. A consumer can likewise commit its database changes and acknowledgement together. These are database transactions, with the same commit and rollback boundary as the rest of the application. External requests remain outside that boundary.
Topics distribute messages; queues track progress
Publish to a topic. Every live queue subscribed at publication receives its own delivery. A queue created later does not receive earlier publications.
One named queue can be shared by several workers. Each delivery is claimed by one worker at a time; unacknowledged work can be attempted again. To give independent subscribers their own progress and retry policy, create a different queue for each subscriber.
Durable queues keep their identity and backlog while consumers are disconnected. Exclusive queues expire when their application stops maintaining them for the configured lifetime window. Exclusive describes lifetime, not a single-consumer access restriction.
Both queue lifetimes support FIFO delivery through group keys. Related messages in one group are handled in order within each queue; different groups can proceed concurrently.
What runs in a deployment
| Component | Responsibility |
|---|---|
| PostgreSQL | Store messages, coordinate claims, commit settlements, and provide database durability. |
| Application processes | Publish and process messages, handle cancellation and duplicates, and own connections. |
| Maintenance scheduler | Retire exhausted deliveries, remove expired subscriptions, and collect retained completed data. |
| Optional telemetry collector | Collect database queue state alongside application metrics. |
The CLI installs and migrates the SQL schema. It is not a worker daemon, scheduler, or replacement for PostgreSQL administration. Using an SDK does not automatically install the schema or start maintenance.
Where PostgreMQ fits
PostgreMQ is useful when queue operations should participate in existing PostgreSQL transactions, or when operating queue state in PostgreSQL fits the team's deployment and recovery model. It supports shared background work, independent subscriptions, delayed delivery, and ordered processing within groups.
Using a separate database for the queue can isolate its workload, but application writes in another database can no longer commit atomically with PostgreMQ publication. This is a deployment choice with a direct effect on the Transactional outbox guarantee.
The operational work lives in PostgreSQL: connection capacity, storage growth, write load, WAL, vacuuming, backups, and failover. Fan-out adds delivery state for every subscribed queue. A slow subscriber retains its own backlog and can keep shared payloads stored. Measure the combined workload rather than assuming queue traffic has no effect on application queries.
Boundaries
PostgreMQ does not provide AMQP compatibility, exchange binding rules, or a retained event stream with consumer offsets. Queues receive publications from their one topic; acknowledgements advance delivery state rather than an independently rewindable log position.
Delivery is at least once under the conditions in Delivery guarantees. An acknowledgement does not make an external effect exactly once, and FIFO ordering does not deduplicate repeated publication. Retry limits, queue expiry, and deliberate deletion can end further delivery.
Start with the Quick start, then choose the queue lifetime and failure policy your application requires. For production, Planning a deployment brings the database and application responsibilities together.