Re: Fix for Extra Parenthesis in pgbench progress message

Nathan Bossart <nathandbossart@gmail.com>

From: Nathan Bossart <nathandbossart@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: Fujii Masao <masao.fujii@oss.nttdata.com>, Tatsuo Ishii <ishii@postgresql.org>, pgsql-release@lists.postgresql.org, pgsql-hackers@postgresql.org
Date: 2025-02-07T17:57:12Z
Lists: pgsql-hackers
On Fri, Feb 07, 2025 at 12:28:16PM -0500, Andres Freund wrote:
> I just did pgbench -i 100 -q via ssh and noticed it was *way* slower than I
> expected.  Did it with debian's pgbench, no such issue.
> 
> It's due to this patch.
> 
> /srv/dev/build/m-opt/src/bin/pgbench/pgbench -i -s 10 -Idtg -h /tmp -q > /tmp/pgiu 2>&1
> 
> With HEAD:
> pgbench -i -s 10 -Idtg -h /tmp -q 2>&1|wc
> 1000114      52 1000448
> 
> With af35fe501af reverted:
> pgbench -i -s 10 -Idtg -h /tmp -q 2>&1|wc
>       6      52     340
> 
> Outputting that many lines to the terminal causes noticeable slowdowns even
> locally and make the terminal use a *lot* more cpu cycles.

Presumably we should only fputc(eol, stderr) when we actually fprintf()
above this point.

> Given the upcoming set of minor releases, I think it may be best for this this
> patch ought to be reverted for now.

+1, since we're nearing the freeze and this doesn't seem like a
particularly urgent bug fix.

-- 
nathan



Commits

  1. Fix pgbench performance issue induced by commit af35fe501.

  2. pgbench: Ensure previous progress message is fully cleared when updating.