From: Tom Lane <tgl@sss.pgh.pa.us>
To: Merlin Moncure <mmoncure@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Cc: Fujii Masao <masao.fujii@gmail.com>
Cc: vignesh C <vignesh21@gmail.com>
Subject: Re: Up to 50x degradation in dblink performance when receiving notice traffic 19 vs 18
Date: Tue, 22 Sep 2026 16:31:41 -0400
Message-ID: <1201635.1790109101@sss.pgh.pa.us> (raw)
In-Reply-To: <CAHyXU0yDwOYkWpRi=gtpDwjBxVqeaezgkgZLRWm2p1_FgaiPFQ@mail.gmail.com>
References: <CAHyXU0yDwOYkWpRi=gtpDwjBxVqeaezgkgZLRWm2p1_FgaiPFQ@mail.gmail.com>
Merlin Moncure <mmoncure@gmail.com> 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, mmoncure@gmail.com, masao.fujii@gmail.com, vignesh21@gmail.com
Subject: Re: Up to 50x degradation in dblink performance when receiving notice traffic 19 vs 18
In-Reply-To: <1201635.1790109101@sss.pgh.pa.us>
References: <CAHyXU0yDwOYkWpRi=gtpDwjBxVqeaezgkgZLRWm2p1_FgaiPFQ@mail.gmail.com> <1201635.1790109101@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox