Planning a deployment
A PostgreMQ deployment consists of PostgreSQL, application clients, and scheduled maintenance. The database owns message state and coordinates consumers. Applications own business processing and cancellation; a scheduler owns cleanup and recovery of exhausted attempts.
Plan all three before deciding that a successful publish-and-consume test is sufficient for production.
Choose the database boundary
Install PostgreMQ in the application database when application writes and queue operations must share a transaction. The fixed postgremq schema keeps queue objects separate from application schemas, but both workloads share database resources and recovery.
A separate queue database can give queue traffic its own capacity and operational lifecycle. It also removes the same-database transaction boundary with application data. Transactional outbox does not extend across databases simply because both servers run PostgreSQL.
Use PostgreSQL 15 or later. Check Compatibility for language requirements and tested combinations. A managed service must allow schema creation, the required SQL functions, connections for workers and listeners, and whatever maintenance scheduler you choose. PostgreMQ does not require a PostgreSQL extension; using an optional extension such as pg_cron depends on the service.
Budget connections and work
Keep one long-lived SDK connection per application configuration rather than constructing one for every publication or message. Count every replica and every pool when calculating database connections.
Go holds a listener connection from its pool once consumption starts. TypeScript holds a pooled listener while subscriptions exist. Rust uses a separate listener pool outside its main pool. Reserve capacity for that listener, claims, acknowledgements, renewals, application transactions, maintenance, and monitoring. A consumer pool with no connection left for settlement can stall its own progress.
LISTEN requires a session connection. A transaction-mode pooler cannot preserve the listener session. Use direct connections or a session-mode route for SDK deployments; do not assume polling makes an unsupported pooler configuration safe. Size pools against the database's actual connection budget and the number of application replicas.
Estimate the workload
Record publication rate, live queues per topic, payload sizes, processing duration, retry rate, ordered-group skew, and expected offline backlog. Fan-out creates delivery state for each queue, even when the payload is shared. The slowest subscriber can keep payloads retained after other subscribers complete.
Choose finite attempt limits, retention periods, maintenance frequency, and acceptable recovery time deliberately. An Exclusive queue's lifetime should tolerate the interruptions the application is expected to survive; use Durable queues when a subscription must retain work through indefinite consumer downtime.
Establish operational ownership
| Responsibility | Required decision |
|---|---|
| Installation and upgrades | Who holds schema ownership and runs the selected release's migrations? |
| Runtime access | Which database roles can read payloads and mutate queue state? |
| Maintenance | Which scheduler runs the jobs, and who is alerted when it stops? |
| Monitoring | Which queue-age, retry, database, and storage symptoms require action? |
| Recovery | What data loss and recovery time are acceptable, and how are external effects reconciled? |
Before launch, complete Installation, Permissions, Maintenance, and Monitoring. Rehearse a worker crash, a database interruption, and a backup restore. Measure the representative workload described in Performance and capacity, including slow consumers and accumulated backlog rather than only an empty queue.