PostgreSQL LISTEN/NOTIFY Bottleneck: What We Learned in Production

Follow me on: 🦣 https://fosstodon.org/@vyruss 🦋 https://bsky.app/profile/vyruss.org   / vyruss   Are you using PostgreSQL's LISTEN and NOTIFY features for asynchronous inter-process communication (IPC)? While elegant and lightweight, they might be hiding a massive performance bottleneck in your high-throughput production database. In this talk from POSETTE: An Event for Postgres 2026, Jimmy Angelakos (Staff Software Engineer at pgEdge) dives into a real-world production incident where NOTIFY inadvertently brought a busy database to a grinding halt. You will learn how the internal serialization of notifications can cause lock cascades on the global database catalog, and more importantly, how to architect a bulletproof fix using unlogged tables, advisory locks, and batching to triple your transaction throughput. What You Will Learn: How PostgreSQL's LISTEN and NOTIFY commands work under the hood. The hidden trap of "accidental serialization" and how it triggers AccessExclusive locks on pg_database. Step-by-step architectural fixes to decouple notification sending from transaction commits. How to use unlogged queue tables and transaction-level advisory locks (pg_try_advisory_xact_lock) to batch send notifications without blocking your database. Best practices for keeping NOTIFY out of your application's hot path. Video Chapters: 00:00 - Introduction & About the Speaker 01:30 - Understanding PostgreSQL's LISTEN & NOTIFY 03:25 - How It Works as IPC Inside Postgres 06:32 - Fun Tales from Production: The Incident Architecture 07:57 - Symptoms: Lock Cascades & Spiking Wait Times 10:40 - The Trap: Accidental Serialization Explained 13:09 - Exploring Solutions (Why the App-Side Fix Failed) 14:36 - The Database-Side Fix: Notification Queue Tables 18:07 - Implementing Advisory Locks for Safe Batching 21:22 - Stress Testing the Solution 23:33 - Safe Logging & Monitoring Queue Length 24:04 - Results: Tripling Transaction Throughput 24:39 - Recap & Best Practices 25:30 - Special Discount & Q&A Info