PostgreSQL queues done right with PgQ | POSETTE: An Event for Postgres 2026

Microsoft Developer · Beginner ·🏗️ Systems Design & Architecture ·1mo ago

Key Takeaways

Implements PostgreSQL queues using PgQ for background jobs and event-driven architectures

Original Description

Learn how PostgreSQL queues can be implemented using PgQ. Alexander Kukushkin (Microsoft) demonstrates this in his talk “PostgreSQL queues done right with PgQ” at POSETTE: An Event for Postgres 2026. Abstract: Modern applications often rely on message queues - for background jobs, data pipelines, notifications, and event-driven architectures. Using something external like Kafka, Redis, RabbitMQ, etc increases operational complexity and introduces new failure modes. It all could be avoided by keeping a message queue in a database. Quick research on the internet shows that developers commonly are trying to engineer the database queue based on SELECT … FOR UPDATE SKIP LOCKED (available since 9.5). This approach works reasonably well under small load, and spectacularly falls apart if subscribers can’t keep up with publishing rate. PostgreSQL can do better, and in fact, it already did. PgQ is PostgreSQL extension that provides generic, high-performance lockless queue with simple SQL. In this talk, we start with why common SELECT … FOR UPDATE SKIP LOCKED approaches fall apart under load, and how PgQ quietly solved those problems a couple decades ago. Then we take a deep look at PgQ internals: snapshot-based event reads, transaction-ordered delivery, and how PgQ gets away with just a single index to achieve high throughput and consistency. Finally, we will discuss practical patterns for running PgQ on managed PostgreSQL services where this extension is typically not available. Alexander Kukushkin is better known in the PostgreSQL community as "the Patroni guy". Patroni is an open source tool for implementing PostgreSQL clustering and high availability. Besides Patroni, Alexander occasionally contributes to PostgreSQL and other open source projects and tools, usually Postgres related. Alexander is a Principal Software Engineer at Microsoft ► Video chapters: ⏩ 00:00 – Music & introduction ⏩ 00:26 – Agenda: queues, problems, PgQ ⏩ 01:15 – Why use in-database queues ⏩ 02:
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Related Reads

📰
SvelteKit 2 Complete Guide: From Zero to Production (2026)
Learn how to build a full-stack application with SvelteKit 2 and Svelte 5's rune system, from setup to production, and boost your productivity
Dev.to · Carlos Oliva Pascual
📰
Implementing a Game Character Evolution System Backend: A 4-Stage System Design
Learn to design a 4-stage game character evolution system backend to integrate with point shops and inventory systems
Dev.to · 박준희
📰
High Level System Design Day-16 — Websockets (Part 4)
Learn to design scalable systems using WebSockets for real-time communication, a crucial skill for backend engineers
Medium · Programming
📰
The Template Method Pattern: Reusing Structure, Not Just Code
Learn the Template Method pattern to reuse algorithm structures and customize varying steps in subclasses
Medium · Programming
Up next
How To Install iOS 27 Beta on iPhone for FREE! (Step-by-Step)
Ksk Royal
Watch →