PGMQ

active

by PGMQ community (originally Tembo) · since 2023 · also known as Postgres Message Queue, pgmq

An SQS-style message queue implemented as a lightweight Postgres extension.

relationalextensionopen source (permissive)growing

Overview

PGMQ gives Postgres an SQS-like queue API: send, read with a visibility timeout, archive and delete, all as SQL functions over ordinary tables. Because messages live in Postgres, enqueueing can join the same transaction as your business writes, removing dual-write problems, and you avoid running a separate broker. Originally built at Tembo, the project now lives in its own community GitHub organization, is written in plain SQL so it installs even on managed Postgres without custom binaries, and is bundled by Supabase as Supabase Queues. Expect thousands, not millions, of messages per second.

Strengths & trade-offs

Strengths

  • +Transactional enqueue in the same commit as application data
  • +No extra infrastructure if you already run Postgres
  • +Pure SQL install works on many managed Postgres services
  • +Exactly-once delivery within the visibility timeout semantics, plus archiving

Trade-offs

  • −Throughput and latency limited by Postgres write capacity and vacuum
  • −Polling model; no push delivery to consumers
  • −No fan-out pub/sub or consumer groups like Kafka

Great for

  • +Background job queues for Postgres-backed apps
  • +Outbox pattern without a separate broker
  • +Lightweight task queues on Supabase

Think twice for

  • −Very high-throughput event streaming
  • −Multi-subscriber pub/sub

Capabilities

Native or official first-party support · 3 of 25 tracked

✓Transactions
✓JSON
✓Durable persistence
–Joins
–Secondary indexes
–Full-text search
–Vector search
–Geospatial
–Change data capture
–Triggers
–Stored procedures
–Materialized views
–TTL / expiry
–Pub/Sub
–Columnar storage
–In-memory
–Compression
–Encryption at rest
–Role-based access
–Time travel
–Branching
–Online schema changes
–Streaming ingest
–Offline sync
–Runs in WebAssembly

Scale & consistency

Comfortable data size
Small · ≤ 100 GB
Horizontal scaling
None
Multi-region
No
Transactions
Full ACID
Consistency
Strong
Schema
Strict
Architecture
Single node, Primary replica, Client server
Query languages
SQL

Throughput bounded by the host Postgres; partitioned queues via pg_partman help retention.

Deployment

Self-hosted Vendor-managed cloud Serverless Embedded Edge Kubernetes operator

available on · AWS · Google Cloud · Azure

Ecosystem

compatible withPostgreSQL
apis & protocolsPostgreSQL wire protocol
client languagesPython, Rust, JavaScript, Go, Java, C#, Elixir
used bySupabase

Alternatives to PGMQ

Compare all→
RedisKey-Value84.3

The in-memory data structure server that became the default cache, now with search, JSON and vectors built in.

pgmq vs redis →
ValkeyKey-Value58.0

The Linux Foundation's BSD-licensed fork of Redis, now the default engine on AWS and Google Cloud.

pgmq vs valkey →
KurrentDB (EventStoreDB)Event Store18.6

A purpose-built event store for event sourcing, with streams, subscriptions and projections.

pgmq vs kurrentdb →
PostgreSQLRelational93.2

The extensible, standards-first open-source relational database.

pgmq vs postgresql →
Comdb2Relational10.9

Bloomberg's clustered relational database with optimistic concurrency and synchronous replication.

pgmq vs comdb2 →
BedrockRelational2.5

Expensify's WAN-replicated SQLite server with Paxos leader election, MySQL protocol and job/cache plugins.

pgmq vs bedrock →

PGMQ FAQ

What is PGMQ?

PGMQ is a relational database by PGMQ community (originally Tembo), first released in 2023. PGMQ gives Postgres an SQS-like queue API: send, read with a visibility timeout, archive and delete, all as SQL functions over ordinary tables. Because messages live in Postgres, enqueueing can join the same transaction as your business writes, removing dual-write problems, and you avoid running a separate broker. Originally built at Tembo, the project now lives in its own community GitHub organization, is written in plain SQL so it installs even on managed Postgres without custom binaries, and is bundled by Supabase as Supabase Queues. Expect thousands, not millions, of messages per second.

Is PGMQ open source?

Yes. PGMQ is open source. License: PostgreSQL License.

Does PGMQ support ACID transactions?

Yes. PGMQ supports full ACID transactions, with strong consistency.

Does PGMQ scale horizontally?

PGMQ does not scale horizontally; it runs on a single node, so you scale it up rather than out. It is comfortable at small scale (≤ 100 GB).

How can I run PGMQ?

You can self-host it. Managed offerings include Supabase Queues. It is available on AWS, Google Cloud and Azure.

What is PGMQ best for?

PGMQ is a strong fit for background job queues for Postgres-backed apps, outbox pattern without a separate broker and lightweight task queues on Supabase. Think twice for very high-throughput event streaming.

What are the best alternatives to PGMQ?

Common alternatives to PGMQ include Redis, Valkey, KurrentDB (EventStoreDB), PostgreSQL and Comdb2. The right choice depends on your workload, scale and hosting; WhichDB's smart match ranks them against your requirements.

How popular is PGMQ?

PGMQ ranks #145 of 844 databases on the WhichDB Score (21.1/100), and #47 among relational databases. The score combines public adoption signals such as package downloads, GitHub activity, job posts and developer discussion.