Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iP7pk-0007tZ-Gm for pgsql-performance@arkaria.postgresql.org; Mon, 28 Oct 2019 16:25:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iP7pj-0000cB-9Y for pgsql-performance@arkaria.postgresql.org; Mon, 28 Oct 2019 16:25:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iP7pj-0000c4-0g for pgsql-performance@lists.postgresql.org; Mon, 28 Oct 2019 16:25:31 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iP7pg-0005iO-UA for pgsql-performance@lists.postgresql.org; Mon, 28 Oct 2019 16:25:30 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x9SGPPP3024270; Mon, 28 Oct 2019 12:25:25 -0400 From: Tom Lane To: =?UTF-8?Q?Gr=c3=a9goire_de_Turckheim?= cc: pgsql-performance@lists.postgresql.org Subject: Re: Notifications within triggers seem to compromise performance In-reply-to: <1c0c95b4-01c4-bbbf-0e6e-f5d530e63ba0@scaleway.com> References: <2b617759-5c59-de3c-1de0-bed20d9c0db1@scaleway.com> <15979.1572272524@sss.pgh.pa.us> <1c0c95b4-01c4-bbbf-0e6e-f5d530e63ba0@scaleway.com> Comments: In-reply-to =?UTF-8?Q?Gr=c3=a9goire_de_Turckheim?= message dated "Mon, 28 Oct 2019 16:39:30 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <24268.1572279925.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Mon, 28 Oct 2019 12:25:25 -0400 Message-ID: <24269.1572279925@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk =?UTF-8?Q?Gr=c3=a9goire_de_Turckheim?= writes: > Le 28/10/2019 à 15:22, Tom Lane a écrit : >> We made some performance improvements for NOTIFY just a couple months >> ago, cf commits b10f40bf0, bb5ae8f6c, bca6e6435, 51004c717. It would >> be interesting to know how much those changes helped your use-case. > If my understanding of the problem is correct, there is no performance > issue with the notification itself. > The problem is the following: a system-wide lock is taken pre-commit, so > any other transaction with a NOTIFY will have to wait for other > transactions to complete before it can leave its own pre-commit stage. Right, but all commits are single-threaded at some granularity. The big problem with NOTIFY is that it sits for a long time holding that lock, if you have a lot of notify traffic. The commits I mentioned should improve that. Anyway, as I said, it would be good to find out whether the already finished fixes are enough to solve your problem, before we debate whether more needs to be done. regards, tom lane