<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/pgq-and-pgque-workflow-engines-you-might-need-in-postgresql-cglyhhqde" -->

---
title: PgQ and PgQue: Workflow Engines you might need in PostgreSQL
description: PgQue is a modern, dependency-free reimplementation of the older PgQ queueing framework for PostgreSQL, designed to let teams build workflow engines and...
canonical: https://daily.dev/posts/pgq-and-pgque-workflow-engines-you-might-need-in-postgresql-cglyhhqde
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: PgQ and PgQue: Workflow Engines you might need in PostgreSQL | daily.dev
og:description: PgQue is a modern, dependency-free reimplementation of the older PgQ queueing framework for PostgreSQL, designed to let teams build workflow engines and...
og:url: https://daily.dev/posts/pgq-and-pgque-workflow-engines-you-might-need-in-postgresql-cglyhhqde
og:image: https://api.daily.dev/og/posts/cgLyhhQdE.png
og:image:alt: PgQ and PgQue: Workflow Engines you might need in PostgreSQL
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# PgQ and PgQue: Workflow Engines you might need in PostgreSQL

**[Planet PostgreSQL](https://daily.dev/sources/planet-postgresql)** · 8 min read · 1 upvotes · 0 comments

## Summary

PgQue is a modern, dependency-free reimplementation of the older PgQ queueing framework for PostgreSQL, designed to let teams build workflow engines and event-driven pipelines without Kafka. Unlike naive SQL-based queues that cause table bloat via UPDATE-based status tracking, PgQue uses an append-only log with snapshot-based batching, tick generation, and per-consumer cursors to avoid bloat and concurrency bottlenecks. It adds queue semantics Kafka lacks natively—per-consumer redelivery, a built-in dead-letter queue, and experimental competing-consumer support—while differing from Kafka in that it has no partitions and cursors track time-based ticks rather than message offsets. Client libraries exist for Python, Go, TypeScript, and Ruby, and the piece walks through publishing, receiving, acking, and nacking events, plus configuring retry thresholds and DLQ behavior.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://postgr.es/p/9wp>

## Questions this post answers

### How does PgQue avoid the table bloat that a typical FOR UPDATE SKIP LOCKED queue causes in PostgreSQL?

PgQue avoids bloat by never updating rows to track status. Instead, events are inserted into an append-only, partitioned log, and each consumer independently tracks its read position via a snapshot-based cursor. Since nothing is updated in place, there are no repeated UPDATEs triggering autovacuum churn, eliminating the concurrency bottlenecks and bloat seen in naive SQL queue implementations.

_daily.dev surfaces practical deep dives like this for engineers weighing PostgreSQL-native queues against Kafka._

### What is the difference between PgQue's cursor model and Kafka's offset-based consumer tracking?

PgQue cursors point at a tick, a time slice, rather than at an individual message offset like Kafka. A consumer commits progress as 'through tick 900' instead of 'through event 4712.' PgQue also lacks partitions, so there is no per-key ordering guarantee, and retention is managed by rotating and truncating tables only after the slowest consumer has moved past them, with a default 2-hour rewind window.

_Comparing queueing semantics like this helps teams pick the right tool; daily.dev keeps that research in one place._

### Does PgQue support a dead-letter queue and message retries like Kafka consumer patterns?

Yes, PgQue implements a built-in dead-letter queue (DLQ) and configurable retry counts. Failed messages are negative-acknowledged (nacked) before the batch is acknowledged, moved to a retry queue, and re-enqueued after a configured delay; once a configured retry threshold is exceeded, the event moves permanently to the DLQ instead of retrying indefinitely.

_Engineers designing retry and DLQ logic can track frameworks like PgQue's approach through daily.dev._

## Similar posts on daily.dev

- [GitHub - NikolayS/pgque: PgQue – Zero-bloat Postgres queue. One SQL file to install, pg\_cron to tick.](https://daily.dev/posts/github---nikolays-pgque-pgque-zero-bloat-postgres-queue-one-sql-file-to-install-pg-cron-to-tick-idiaxcm6k) · Hacker News · 80 upvotes · 3 comments
- [Using PostgreSQL as a Dead Letter Queue for Event-Driven Systems](https://daily.dev/posts/using-postgresql-as-a-dead-letter-queue-for-event-driven-systems-ekm9n1imv) · Hacker News · 0 upvotes · 0 comments

---

Tags: [#architecture](https://daily.dev/tags/architecture), [#database](https://daily.dev/tags/database), [#kafka](https://daily.dev/tags/kafka), [#postgresql](https://daily.dev/tags/postgresql)

[View this post on daily.dev](https://daily.dev/posts/pgq-and-pgque-workflow-engines-you-might-need-in-postgresql-cglyhhqde)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"PgQ and PgQue: Workflow Engines you might need in PostgreSQL","url":"https://daily.dev/posts/pgq-and-pgque-workflow-engines-you-might-need-in-postgresql-cglyhhqde","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/pgq-and-pgque-workflow-engines-you-might-need-in-postgresql-cglyhhqde"},"datePublished":"2026-09-28T14:48:05.018Z","dateModified":"2026-10-15T02:22:30.785Z","description":"PgQue is a modern, dependency-free reimplementation of the older PgQ queueing framework for PostgreSQL, designed to let teams build workflow engines and...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/253ef6baa12d18ed931ee25a41300b8d?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/253ef6baa12d18ed931ee25a41300b8d?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Planet PostgreSQL","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Planet PostgreSQL","logo":"https://media.daily.dev/image/upload/logos/placeholder.jpg","url":"https://daily.dev/sources/planet-postgresql"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/pgq-and-pgque-workflow-engines-you-might-need-in-postgresql-cglyhhqde","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"architecture,database,kafka,postgresql","timeRequired":"PT8M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Planet PostgreSQL","item":"https://daily.dev/sources/planet-postgresql"},{"@type":"ListItem","position":3,"name":"PgQ and PgQue: Workflow Engines you might need in PostgreSQL"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/pgq-and-pgque-workflow-engines-you-might-need-in-postgresql-cglyhhqde#faq","mainEntity":[{"@type":"Question","name":"How does PgQue avoid the table bloat that a typical FOR UPDATE SKIP LOCKED queue causes in PostgreSQL?","acceptedAnswer":{"@type":"Answer","text":"PgQue avoids bloat by never updating rows to track status. Instead, events are inserted into an append-only, partitioned log, and each consumer independently tracks its read position via a snapshot-based cursor. Since nothing is updated in place, there are no repeated UPDATEs triggering autovacuum churn, eliminating the concurrency bottlenecks and bloat seen in naive SQL queue implementations. daily.dev surfaces practical deep dives like this for engineers weighing PostgreSQL-native queues against Kafka."}},{"@type":"Question","name":"What is the difference between PgQue's cursor model and Kafka's offset-based consumer tracking?","acceptedAnswer":{"@type":"Answer","text":"PgQue cursors point at a tick, a time slice, rather than at an individual message offset like Kafka. A consumer commits progress as 'through tick 900' instead of 'through event 4712.' PgQue also lacks partitions, so there is no per-key ordering guarantee, and retention is managed by rotating and truncating tables only after the slowest consumer has moved past them, with a default 2-hour rewind window. Comparing queueing semantics like this helps teams pick the right tool; daily.dev keeps that research in one place."}},{"@type":"Question","name":"Does PgQue support a dead-letter queue and message retries like Kafka consumer patterns?","acceptedAnswer":{"@type":"Answer","text":"Yes, PgQue implements a built-in dead-letter queue (DLQ) and configurable retry counts. Failed messages are negative-acknowledged (nacked) before the batch is acknowledged, moved to a retry queue, and re-enqueued after a configured delay; once a configured retry threshold is exceeded, the event moves permanently to the DLQ instead of retrying indefinitely. Engineers designing retry and DLQ logic can track frameworks like PgQue's approach through daily.dev."}}]}
```

