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 1tgScr-00AsX4-34 for pgsql-hackers@arkaria.postgresql.org; Fri, 07 Feb 2025 17:58:49 +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 1tgSco-003rt8-Tn for pgsql-hackers@arkaria.postgresql.org; Fri, 07 Feb 2025 17:58:46 +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 1tgSco-003rsv-KG for pgsql-hackers@lists.postgresql.org; Fri, 07 Feb 2025 17:58:46 +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.96) (envelope-from ) id 1tgScm-003oAf-29; Fri, 07 Feb 2025 17:58:45 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 517HwcOB1456497; Fri, 7 Feb 2025 12:58:38 -0500 From: Tom Lane To: Andres Freund cc: Fujii Masao , Tatsuo Ishii , pgsql-release@lists.postgresql.org, pgsql-hackers@postgresql.org Subject: Re: Fix for Extra Parenthesis in pgbench progress message In-reply-to: <4k4drkh7bcmdezq6zbkhp25mnrzpswqi2o75d5uv2eeg3aq6q7@b7kqdmzzwzgb> References: <85fe426d-248a-47f7-8784-22af811ee572@oss.nttdata.com> <20241108.114713.484828673471024549.ishii@postgresql.org> <95f1100e-e59b-41b7-a406-f865c2e69db7@oss.nttdata.com> <20241125.083155.1820744655877715597.ishii@postgresql.org> <4k4drkh7bcmdezq6zbkhp25mnrzpswqi2o75d5uv2eeg3aq6q7@b7kqdmzzwzgb> Comments: In-reply-to Andres Freund message dated "Fri, 07 Feb 2025 12:28:16 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1456495.1738951118.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 07 Feb 2025 12:58:38 -0500 Message-ID: <1456496.1738951118@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andres Freund writes: > I just did pgbench -i 100 -q via ssh and noticed it was *way* slower tha= n I > expected. Did it with debian's pgbench, no such issue. > It's due to this patch. Oh! The problem is that the hunk + /* + * If the previous progress message is longer than the current one= , + * add spaces to the current line to fully overwrite any remaining + * characters from the previous message. + */ + if (prev_chars > chars) + fprintf(stderr, "%*c", prev_chars - chars, ' '); + fputc(eol, stderr); + prev_chars =3D chars; is executed unconditionally for each data row, when we should only run it when we printed something. It's kind of invisible if "eol" is \r, but I can believe that it's driving the terminal nuts. Trying it here, it also makes the thing practically unresponsive to control-C. > Given the upcoming set of minor releases, I think it may be best for thi= s this > patch ought to be reverted for now. Seems easy enough to fix. But it's now middle of the night Saturday morning in Japan, so I doubt Masao-san or Ishii-san will see this for awhile. And the release freeze is coming up fast. Let me have a go at fixing it, and if it turns out to be harder than I think, I'll revert it instead. regards, tom lane