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.98.2) (envelope-from ) id 1x979a-00000001kXU-3Gqj for pgsql-hackers@arkaria.postgresql.org; Tue, 22 Sep 2026 20:31:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1x979Z-00000001LhO-4AzP for pgsql-hackers@arkaria.postgresql.org; Tue, 22 Sep 2026 20:31:49 +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.98.2) (envelope-from ) id 1x979Z-00000001LhF-2w1I for pgsql-hackers@lists.postgresql.org; Tue, 22 Sep 2026 20:31:49 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1x979X-00000000jJd-0sPw for pgsql-hackers@postgresql.org; Tue, 22 Sep 2026 20:31:48 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.18.1/8.18.1) with ESMTP id 68MKVf901201636; Tue, 22 Sep 2026 16:31:41 -0400 From: Tom Lane To: Merlin Moncure cc: PostgreSQL-development , Fujii Masao , vignesh C Subject: Re: Up to 50x degradation in dblink performance when receiving notice traffic 19 vs 18 In-reply-to: References: Comments: In-reply-to Merlin Moncure message dated "Tue, 22 Sep 2026 13:34:06 -0600" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1201634.1790109101.1@sss.pgh.pa.us> Date: Tue, 22 Sep 2026 16:31:41 -0400 Message-ID: <1201635.1790109101@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Merlin Moncure writes: > Bisecting revealed the obvious culprit: > 112faf1378ee: Log remote NOTICE, WARNING, and similar messages using > ereport(). > The commit solves an obvious problem, and I do not think it should be > reverted. This does raise a couple of questions, however: > * Is it really true that ereport() is up to 20x slower than stderr? > * Why does stderr have such wierd performance variations? I did a simple performance test, measuring tight loops around ereport(LOG, errmsg_internal("%s", my_string)); and fprintf(stderr, "%s\n", my_string); For me, ereport is consistently about 3x slower than fprintf when using bare log-to-a-file (logging_collector off), or about 2x slower when using the logging collector with default options. That's more or less in line with what I'd expect. So there's something odd going on in your setup; where is log output going exactly? > * Why does dblink even bother with NOTICE level messages at all? They are > not produced at all to the receiving client, only to the hosting database > log (which IMO is very non-intuitive). I think the intent of 112faf137 was to get log message prefixes attached to these messages without disturbing the pre-existing behavior about what gets recorded where. Maybe there's room for a discussion about changing that, but since postgres_fdw has been acting like that for a long time it might be a hard sell. regards, tom lane