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 1vDdP3-00ChR2-RI for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Oct 2025 06:41:57 +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 1vDdP1-00B70t-Me for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Oct 2025 06:41:54 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vDdP1-00B70k-0e for pgsql-hackers@lists.postgresql.org; Tue, 28 Oct 2025 06:41:54 +0000 Received: from fout-a1-smtp.messagingengine.com ([103.168.172.144]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1vDdOx-0049xL-1B for pgsql-hackers@postgresql.org; Tue, 28 Oct 2025 06:41:52 +0000 Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.phl.internal (Postfix) with ESMTP id 7D4A7EC03D9; Tue, 28 Oct 2025 02:41:50 -0400 (EDT) Received: from phl-imap-03 ([10.202.2.93]) by phl-compute-05.internal (MEProxy); Tue, 28 Oct 2025 02:41:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=compiler.org; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1761633710; x=1761720110; bh=Slh/ya2qWwUewodr7C0JmBRjlAzshDDUvlbydaKaFVQ=; b= gOPu2iq8kIgj5jZs//KsjaFNlHViJOvoIQvj3Iom2tlAstaO9SJDKRFIaZsAWu4X 28JaJQdsNZb3Zp/c2KkQyZnIz1ee6vkmxLYCq2ND0+JyQ9n85nUtW9bfT9O/r2Bj vzggXVabVbpVEwCBqOvW+p4XKw4JOFrTchsDaaXr5El+lzrVwB9/b0eu4dF0EUvb GtkymI/yOlUlaQDQ0lVmyGoEdhpwH1Eo6V+OBqzvG7RW8xc9+40qE0VbQwN6wiEd e+PBkRBWDBoQOwFs7+kkElYxlsJYt2f7J4d/8QxMFjUj3ZaeYMs7/212JWVUtszN MKEZA9bJhAEkCoGhGU4ZOw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1761633710; x= 1761720110; bh=Slh/ya2qWwUewodr7C0JmBRjlAzshDDUvlbydaKaFVQ=; b=M 8sT3gCCXbtSzmZlSA4uZdxTsm+LA3iph0d2jPuWEOUbt2qcgoj4Az+y1iSLo339p BHyBe51Y9Ryfan6l//7eEAcgThNZKWmheAc54RTdlflY2OazdN+WC6j7sg7xvzod Ky1TjUTJFKMJMew2GVvKIJFcVG13c9mYKtVHO1CBJODeUx55X3lRX5BYg29uGHKj coyxM8fyloh/1+8L/6gSHRV5htAux8UaHCSioAwMudxobIfcsnO5WUrmYW3+sYJr rc4eh2OjmFOJ5oL/VpFKuUS1W/vRCJoVnUFrJYzA1Q5LEqGR7rk5cltzRXK8hxPc k5BpfR0DC13qlRr6XNnNw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdduiedtudeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefoggffhffvvefkjghfufgtgfesthhqre dtredtjeenucfhrhhomhepfdflohgvlhculfgrtghosghsohhnfdcuoehjohgvlhestgho mhhpihhlvghrrdhorhhgqeenucggtffrrghtthgvrhhnpefggfeuheefheeufeegkeeife ffhffgvefftdduuefhfeelteegleehhfdtieevgfenucevlhhushhtvghrufhiiigvpedt necurfgrrhgrmhepmhgrihhlfhhrohhmpehjohgvlhestghomhhpihhlvghrrdhorhhgpd hnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehlihdr vghvrghnrdgthhgrohesghhmrghilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhhrg gtkhgvrhhssehpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: ic6394509:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 1369418E0069; Tue, 28 Oct 2025 02:41:50 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface MIME-Version: 1.0 X-ThreadId: AE1r89ybsZ1g Date: Tue, 28 Oct 2025 07:41:29 +0100 From: "Joel Jacobson" To: "Chao Li" Cc: pgsql-hackers Message-Id: <38de1036-d8cf-420c-b845-edb5a946b191@app.fastmail.com> In-Reply-To: <82DEA2B6-6FC5-4A79-BDE3-1FD72F104A6E@gmail.com> References: <6899c044-4a82-49be-8117-e6f669765f7e@app.fastmail.com> <165530.1752362320@sss.pgh.pa.us> <02a7cd37-e2fc-4212-8b19-f8c239c95fb8@app.fastmail.com> <96f00bf1-cc9d-4520-9d02-9e14e7767c88@app.fastmail.com> <30c2aa7d-dd6c-4b68-a2e4-f217a1a34acf@app.fastmail.com> <0b4d402a-9ac2-4aa8-acf8-8231dbe579ea@app.fastmail.com> <3095599.1758644879@sss.pgh.pa.us> <0dc6a2cc-5216-4dc1-9dd2-430cafc6095b@app.fastmail.com> <52CC167F-763B-4ECA-B0B4-DAB381816828@gmail.com> <9186C6D0-F7A9-482A-9183-89E530B57E36@gmail.com> <1073593.1759423179@sss.pgh.pa.us> <4bd5e6c4-6fa7-44bb-869d-59a32a331fa8@app.fastmail.com> <85828f29-e72e-4400-94f3-9a69bc8dc239@app.fastmail.com> <2495353.1759860890@sss.pgh.pa.us> <8aeae418-92a6-4bbd-9c06-9574c79e59f7@app.fastmail.com> <2531672.1759868124@sss.pgh.pa.us> <474efa78-337c-41cd-a73a-f845a0115109@app.fastmail.com> <2749343.1759949176@sss.pgh.pa.us> <8bfca2be-1ec0-4e15-aafb-0b7b661fe936@app.fastmail.com> <9eba307f-f2fb-48f0-9507-2e197f39ef9e@app.fastmail.com> <8c71183a-0d28-4bcf-a806-78446ff95404@app.fastmail.com> <1009807.1760476747@sss.pgh.pa.us> <1F7227F5-C33D-4E2C-8511-33F1468590D0@gmail.com> <0a5a20d3-4621-46b3-b2ab-903f63a20dea@app.fastmail.com> <6F913129-ABEF-4004-AAF3-F22FC34!29AE8@gmail.com> <1547585.1760645808@sss.pgh.pa.us> <14865EB6-0BF4-462B-9072-10BDAC10C052@gmail.com> <0BCA1C2D-B92C-459E-B1A6-6D06BA4C62CF@gmail.com> <55d24cbb-e9ef-491f-a99b-b3dbd7cecdf9@app.fastmail.com> <38574cad-e90d-47b7-a015-753bb6bbc360@app.fastmail.com> <66631FB7-5BEA-4ED5-A694-9AD8B9CCFEE8@gmail.com> <4b7b49a5-5e1a-44a8-93e0-60457d15cb1d@app.fastmail.com> <82DEA2B6-6FC5-4A79-BDE3-1FD72F104A6E@gmail.com> Subject: Re: Optimize LISTEN/NOTIFY Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Oct 28, 2025, at 02:02, Chao Li wrote: >>> From this perspective, we need to add a new field=20 >>> adviancingTillPos to QueueBackendStatus. (This field was also missin= g=20 >>> from my proposed patch). >>=20 >> I'm doubtful yet another field is worth the added complexity cost. >>=20 >> Before increasing the complexity further, I think we should first >> try to simulate somewhat realistic workloads, to see if we actually >> have a problem first. >>=20 >> /Joel >>=20 > > I don=E2=80=99t think that=E2=80=99s extra complexity, IMO, that just = ensure =E2=80=9Cdirect=20 > advancement=E2=80=9D to be fully functional. An extra field is by definition extra complexity; If it's worth it depends on how much we would gain from it, that's why I'm doubtful it's worth it. The extra adviancingTillPos field would only avoid wakeups in some scenarios, if you study the example given by Arseniy, it's easy to see why we would really need something like a the list of skip ranges Arseniy suggested, per backend, for it to be complete, but that's even more complexity. I don't think it's too bad for a backend to read through the entire queue, even if it contains some entires that are not interesting, when a backend is awaken, processing is fast, that's not the big cost here, what really costs is the context switches. But I've been wrong before, so could be wrong again of course. This is just based on my intuition. > But anyway, we should run some load tests to verify every solution to=20 > see how much they really improve. Do you already have or plan to work=20 > on a load test script? Yes, I'm currently working on a combined benchmark / correctness test su= ite. /Joel