---
title: "Postgres LISTEN/NOTIFY Actually Scales"
description: "Postgres NOTIFY takes a global exclusive lock from commit start through fsync so notifications enqueue in commit order, which serializes every notifying transaction and blocks group commit."
url: "https://swe.quest/articles/postgres-listen-notify-actually-scales-a299c10c9793118e"
canonical: "https://www.dbos.dev/blog/postgres-listen-notify-scalability"
source: "DBOS"
published: "2026-07-24"
difficulty: "medium"
kind: "Deep dive"
reading_minutes: 5
tags: ["postgres","messaging","performance","storage-engines","concurrency"]
---

# Postgres LISTEN/NOTIFY Actually Scales

A post on [DBOS](https://swe.quest/sources/dbos.md), published 2026-07-24, 5 min read, Deep dive. Original: [https://www.dbos.dev/blog/postgres-listen-notify-scalability](https://www.dbos.dev/blog/postgres-listen-notify-scalability)

## Summary

Postgres NOTIFY takes a global exclusive lock from commit start through fsync so notifications enqueue in commit order, which serializes every notifying transaction and blocks group commit. A trigger-per-insert stream design therefore capped at about 2.9K writes/sec with idle CPU and disk. Because notifications only signal readers to re-check a table that remains the source of truth, buffering them in memory and flushing in periodic batches removes the contention, with low-frequency reader polling covering notifications lost to crashes. The batched design reached about 60K stream writes/sec on one server, 20x the original, with CPU saturated instead of lock-bound; the upcoming Postgres 19 patch does not remove this lock.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [Queues & messaging](https://swe.quest/tags/messaging.md) (Backend & APIs)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [Storage engines](https://swe.quest/tags/storage-engines.md) (Data & databases)
- [Concurrency](https://swe.quest/tags/concurrency.md) (Compilers & runtimes)

## Prerequisites

- PostgreSQL triggers ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))
- transaction commit and fsync
- pub/sub basics

## Keywords

LISTEN/NOTIFY, PostgreSQL, DBOS, group commit, pg\_notify

## Related posts

- [What's New with Monitoring in PostgreSQL 19](https://swe.quest/articles/what-s-new-with-monitoring-in-postgresql-19-e4c0bc9dee606e4c.md): ClickHouse · 2026-08-18 · Medium · 8 min read · PostgreSQL, Observability, Databases
  PostgreSQL 19 (in beta) brings a batch of monitoring improvements. log\_lock\_waits is now on by default, log\_min\_messages accepts per-process-type levels, and autoanalyze gets its own log\_autoanalyze\_min\_duration threshold.
- [Rebuilding Linear’s delta sync read path](https://swe.quest/articles/rebuilding-linear-s-delta-sync-read-path-c44713dd7fac387a.md): Linear · 2026-08-18 · Medium · 7 min read · Local-first & sync, PostgreSQL, Search, Event-driven architecture, Performance engineering
  Linear moved its delta sync read path, which lets reconnecting local-first clients fetch only changes since their last checkpoint, from a Postgres table to turbopuffer inverted indexes.
- [From v0.7 to v0.8: How group commit changed Turso's tail latency](https://swe.quest/articles/from-v0-7-to-v0-8-how-group-commit-changed-turso-s-tail-latency-395b8a8a61113276.md): Turso · 2026-09-29 · Medium · 13 min read · Storage engines, SQLite, Performance engineering, Concurrency, Databases
  Turso v0.8 adds group commit to its MVCC write path so that concurrent committers share a single fsync of the logical log instead of each paying for their own.
- [How savepoints quietly throttled our Postgres queue](https://swe.quest/articles/how-savepoints-quietly-throttled-our-postgres-queue-a32737dd90a62c34.md): incident.io · 2026-10-06 · Hard · 15 min read · PostgreSQL, Performance engineering, Storage engines, Concurrency, Scaling
  Using a SAVEPOINT per tick in a Postgres-backed job queue made every locked row carry a MultiXact ID in xmax.
- [Read your writes: WAIT FOR in PostgreSQL 19](https://swe.quest/articles/read-your-writes-wait-for-in-postgresql-19-ead8d2a645bd23c3.md): ClickHouse · 2026-08-25 · Medium · 6 min read · PostgreSQL, Replication, Consistency models
  PostgreSQL 19 adds a top-level \`WAIT FOR LSN\` command that blocks a session until a standby has written, flushed or replayed WAL up to a given LSN, giving read-your-writes consistency on asynchronous replicas without the per-commit cost of \`synchronous\_commit = remote\_apply\`.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
