Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uajUX-0094eh-8A for pgsql-hackers@arkaria.postgresql.org; Sat, 12 Jul 2025 23:18:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uajUU-00Bu1H-5c for pgsql-hackers@arkaria.postgresql.org; Sat, 12 Jul 2025 23:18:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uajUT-00Bu18-SB for pgsql-hackers@lists.postgresql.org; Sat, 12 Jul 2025 23:18:46 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uajUR-007G8s-3A for pgsql-hackers@postgresql.org; Sat, 12 Jul 2025 23:18:46 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 56CNIeH9165531; Sat, 12 Jul 2025 19:18:40 -0400 From: Tom Lane To: "Joel Jacobson" cc: pgsql-hackers Subject: Re: Optimize LISTEN/NOTIFY In-reply-to: <6899c044-4a82-49be-8117-e6f669765f7e@app.fastmail.com> References: <6899c044-4a82-49be-8117-e6f669765f7e@app.fastmail.com> Comments: In-reply-to "Joel Jacobson" message dated "Sun, 13 Jul 2025 00:35:21 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <165529.1752362320.1@sss.pgh.pa.us> Date: Sat, 12 Jul 2025 19:18:40 -0400 Message-ID: <165530.1752362320@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "Joel Jacobson" writes: > The attached proof-of-concept patch proposes a straightforward > optimization for the single-listener case. It introduces a shared-memory > hash table mapping (dboid, channelname) to the ProcNumber of a single > listener. What does that do to the cost and parallelizability of LISTEN/UNLISTEN? > The patch also includes a "wake only tail" optimization (contributed by > Marko Tikkaja) to help prevent backends from falling too far behind. Coulda sworn we dealt with that case some years ago. In any case, if it's independent of the other idea it should probably get its own thread. regards, tom lane