github NikolayS/pgque v0.1.0
PgQue v0.1.0

latest releases: v0.2.0, v0.2.0-rc.2, v0.2.0-rc.1...
pre-releaseone month ago

First tagged release of PgQue — PgQ reborn in pure PL/pgSQL for any Postgres 14+, including managed providers that block C extensions.

PgQ was designed at Skype to carry messaging for hundreds of millions of users and ran on large self-managed Postgres for over a decade. Standard PgQ depends on a C extension and the pgqd daemon — neither available on RDS, Aurora, Cloud SQL, AlloyDB, Supabase, or Neon. PgQue rebuilds that engine in pure PL/pgSQL so the zero-bloat queue pattern works anywhere you can run SQL.

Highlights

  • Single-file install\i sql/pgque.sql, wrapped in one transaction. No shared_preload_libraries, no restart, no provider approval.
  • Zero event-table bloat by design — TRUNCATE-based three-table rotation instead of per-row DELETE. No dead tuples on the hot path, immune to xmin horizon pinning.
  • Snapshot-based batching — no SKIP LOCKED, no row-level claim churn. Stable under sustained load.
  • pg_cron ticker built inselect pgque.start() installs the 1-second ticker plus maintenance jobs. Tick cadence matches pgqd. Any external scheduler (system cron, systemd, app loop) works too.
  • Modern APIsend, send_batch (with text and jsonb overloads), subscribe, unsubscribe, receive, ack, nack layered on top of the classic PgQ primitives.
  • DLQ promoted to the default install — dead-letter handling is shipped, not experimental.
  • Three roles, no superuser needed for appspgque_reader, pgque_writer, pgque_admin. uninstall() is superuser-only.
  • Example clients — Python (psycopg 3), Go (pgx/v5), TypeScript (node-postgres) — integration patterns, not stable SDKs.
  • PostgreSQL 14–18 supported — CI runs across the range.

What is not in v0.1.0

  • Upgrade / reinstall path — treat installation as one-way for now.
  • Auto-detection of pg_cron in a different database from PgQue — manual cross-database pattern required; automation is roadmap.
  • Revoking DDL-class functions (create_queue, drop_queue, start, stop, maint, ticker, force_tick) from PUBLIC — on the roadmap.
  • Sub-second delivery — default end-to-end latency is ~1–2 s; logical-decoding wake-ups are future work.
  • No C accelerator, by design.

Project status: early-stage as packaging and API layer. The PgQ engine underneath is decade-proven.

Install

\i sql/pgque.sql
select pgque.start();   -- optional, if pg_cron is available

Credits

Derived from PgQ (ISC, Marko Kreen / Skype Technologies OU). Brandur Leach's 2015 Postgres queues writeup frames the bloat pathology PgQue sidesteps by construction.

Don't miss a new pgque release

NewReleases is sending notifications on new releases.